@@ -, +, @@ tool. Test plan: 1. Go through the web installer as outlined in the below link. But go through the web installer 4 times to test the basic and advanced setup modes of the web installer: https://koha-community.org/manual/installation/html/ Note: Each time you have finished the web installer restart memcached service with: sudo service memcached restart and drop and recreate the database. 2. Attempt 1 : Choose basic and MARC21. Notice the bulletpoints for default sample data on web installer step 3, and unticked checkboxes for optional data values. Attempt 2: Choose basic and UNIMARC, make the same observation as above. Attempt 3: Choose advanced and MACR21 notice all data values have unticked checkboxes (including the default data values) Attempt 4: Choose advanced and UNIMARC and make same observation as above. 3. After your fourth attempt do not restart memcached or drop and recreate the database. You will be redirected to the onboarding tool automatically after finishing the web installer. 4. Go through the onboarding tool as outlined here: https://koha-community.org/manual/installation/html/ 5. Whilst going through the onboarding tool write in special characters to all text input fields of the onboarding tool and try to submit the form. You should not be able to, due to html regexes being implemented. 6. In the create patron category form try to input a value into both the 'Months:' and 'Until date:' input fields. A message should appear beside the input boxes telling the you to only write in one date value 7. Select a date from the datepicker of the create patron category form 8. Continue through the rest of the onboarding tool as outlined in that above link 9. Once you have finished the onboarding tool and have logged in with the patron account you created in the onboarding tool, try to create a library, patron category, patron, item type and circulation rule. If you can create these then you know that the onboarding tool has successfully set up Koha for you. Therefore the onboarding tool is working as intended. --- installer/install.pl | 17 + installer/onboarding.pl | 189 +++++---- .../prog/en/modules/admin/categories.tt | 2 +- .../prog/en/modules/onboarding/onboardingstep0.tt | 33 +- .../prog/en/modules/onboarding/onboardingstep1.tt | 44 +- .../prog/en/modules/onboarding/onboardingstep2.tt | 454 +++++++++++---------- .../prog/en/modules/onboarding/onboardingstep3.tt | 20 +- .../prog/en/modules/onboarding/onboardingstep4.tt | 4 +- .../prog/en/modules/onboarding/onboardingstep5.tt | 16 +- 9 files changed, 399 insertions(+), 380 deletions(-) --- a/installer/install.pl +++ a/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 . + use strict; use warnings; use diagnostics; --- a/installer/onboarding.pl +++ a/installer/onboarding.pl @@ -1,5 +1,23 @@ #!/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 . + use strict; use warnings; use diagnostics; @@ -100,6 +118,15 @@ if ( $start && $start eq 'Start setting up my Koha' ){ ] ); + +}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, + ); + + #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 variable @@ -107,6 +134,7 @@ if ( $start && $start eq 'Start setting up my Koha' ){ #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; @@ -134,97 +162,85 @@ if ( $start && $start eq 'Start setting up my Koha' ){ $message = 'error_on_insert'; } - $template->param('message' => $message); + $template->param('message' => $message); #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 category code and name in $createcat - $template->param('createcat'=>$createcat); - -#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, - ); - - #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( - { + 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, - } + } ); - #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'); - my $description = $input->param('description'); - my $overduenoticerequired = $input->param('overduenoticerequired'); - my $category_type = $input->param('category_type'); - my $default_privacy = $input->param('default_privacy'); - my $enrolmentperiod = $input->param('enrolmentperiod'); - my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef; - - #Converts the string into a date format - if ( $enrolmentperioddate) { - $enrolmentperioddate = output_pref( +#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'); + my $default_privacy = $input->param('default_privacy'); + my $enrolmentperiod = $input->param('enrolmentperiod'); + my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef; + +#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 a new patron category to the database - $category = Koha::Patron::Category->new({ - categorycode=> $categorycode, - description => $description, - overduenoticerequired => $overduenoticerequired, - category_type=> $category_type, - default_privacy => $default_privacy, - enrolmentperiod => $enrolmentperiod, - enrolmentperioddate => $enrolmentperioddate, - }); + } - eval { - $category->store; - }; +#Adds a new patron category to the database + $category = Koha::Patron::Category->new({ + categorycode=> $categorycode, + description => $description, + overduenoticerequired => $overduenoticerequired, + category_type=> $category_type, + default_privacy => $default_privacy, + enrolmentperiod => $enrolmentperiod, + enrolmentperioddate => $enrolmentperioddate, + }); + + eval { + $category->store; + }; - #Error messages - if($category){ - $message = 'success_on_insert'; - }else{ - $message = 'error_on_insert'; - } +#Error messages + if($category){ + $message = 'success_on_insert'; + }else{ + $message = 'error_on_insert'; + } - $template->param('message' => $message); + $template->param('message' => $message); #Create a patron }elsif ( $step && $step == 3 ){ my $firstpassword = $input->param('password'); my $secondpassword = $input->param('password2'); - - if ($firstpassword ne $secondpassword){ - my $DisplayError='Please rewrite the password'; - warn $DisplayError; - $template->param(DisplayError=>$DisplayError, - ); - } - #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, @@ -244,6 +260,14 @@ if ( $start && $start eq 'Start setting up my Koha' ){ categories => $categories, ); +#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); @@ -251,13 +275,13 @@ if ( $start && $start eq 'Start setting up my Koha' ){ 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' @@ -266,6 +290,7 @@ if ( $start && $start eq 'Start setting up my Koha' ){ :() } +#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)); @@ -273,8 +298,8 @@ if ( $start && $start eq 'Start setting up my Koha' ){ #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); @@ -293,8 +318,9 @@ if ( $start && $start eq 'Start setting up my Koha' ){ } } $template->param('nok' => 1); - warn $nok; - }else{ + +#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, @@ -370,9 +396,6 @@ if ( $start && $start eq 'Start setting up my Koha' ){ my $createitemtype = $input->param('createitemtype'); $template->param('createitemtype'=> $createitemtype ); - my $itemtype_code = $input->param('itemtype'); - my $op = $input->param('op') // 'list'; - my $message; my( $template, $borrowernumber, $cookie) = C4::InstallAuth::get_template_and_user( { template_name => "/onboarding/onboardingstep4.tt", @@ -386,15 +409,20 @@ if ( $start && $start eq 'Start setting up my Koha' ){ if($op eq 'add_validate'){ my $description = $input->param('description'); - - #store the input from the form - only 2 fields + 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{ $itemtype->store; }; - #Error messages + + 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{ @@ -442,8 +470,9 @@ if ( $start && $start eq 'Start setting up my Koha' ){ debug => 1, }); +#If no libraries exist then set the $branch value to * my $branch = $input->param('branch'); - unless ( $branch ) { + unless ( $branch ) { if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) { $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch(); } @@ -456,7 +485,7 @@ if ( $start && $start eq 'Start setting up my Koha' ){ if($op eq 'add_validate'){ my $type = $input->param('type'); - my $br = $branch; + my $br = $input->param('branch'); my $bor = $input->param('categorycode'); my $itemtype = $input->param('itemtype'); my $maxissueqty = $input->param('maxissueqty'); @@ -541,7 +570,7 @@ if ( $start && $start eq 'Start setting up my Koha' ){ if ($res->{total}) { $sth_update->execute($onshelfholds, $branch); } else { - $sth_insert->execute($branch, $onshelfholds); + $sth_insert->execute($branch, $onshelfholds); } } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -93,7 +93,7 @@
  • - +
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt +++ a/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' %] - Welcome › to › Koha - - - - - +

    Welcome to Koha

    Koha

    -

    You haven't installed some sample data, so we're just going to set up a few more things...

    +

    We're just going to set up a few more things...

    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt @@ -4,39 +4,11 @@ Welcome › to › Koha - - - -
    -

    Welcome to Koha test if in correct repo

    +

    Welcome to Koha

    Koha

    [% IF libraries.count > 0 %] @@ -59,7 +31,11 @@

    Success: Library created!

    To add another library and for more settings,
    - go to Tools->Administration->Libraries and Groups + go to:

    + More->Administration->Libraries and groups
    + OR
    + Administration->Libraries and groups +

    Next up: @@ -87,12 +63,12 @@
    1. - + Required
    2. - + Required
    @@ -100,8 +76,8 @@
    -[% END %] - +[% END %] + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt @@ -6,29 +6,9 @@ Add a patron category [% INCLUDE 'installer-doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] - - -$(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 - } - } - - }); - -}) + + +
    @@ -265,7 +292,10 @@ $(document).ready(function(){

    Success: Patron category created!

    To add another patron category and for more settings
    - go to More->Administration->Patrons & Circulation->Patron Categories

    + go to:
    + More->Administration->Patron categories
    + OR
    + Administration->Patron categories

    Next up:
    @@ -280,19 +310,19 @@ $(document).ready(function(){
    - [% END %] - + [% END %] + [% ELSE %] -

    Create a new Patron Category testing rwq

    -
    +

    Create a new Patron Category

    +
    1. - + Required
    2. @@ -361,15 +391,11 @@ $(document).ready(function(){
      1. - months + months
      2. - - ... - - - +
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt @@ -114,7 +114,7 @@ $(document).ready(function(){
    [% ELSE %] -

    Create a new Patron

    +

    Create a new Patron

    Library Management

    Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions. @@ -129,12 +129,12 @@ $(document).ready(function(){

  • - + Required
  • - + Required
  • @@ -142,7 +142,7 @@ $(document).ready(function(){
    1. - + Required
    2. @@ -160,9 +160,9 @@ $(document).ready(function(){
    3. Required
    4. @@ -180,17 +180,17 @@ $(document).ready(function(){

      OPAC/Staff Login

    5. - + Required
    6. - + Required
    7. - + Required
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt @@ -66,12 +66,12 @@
    1. - + Required
    2. - + Required
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt @@ -53,7 +53,7 @@ [% FOREACH category IN categories %] - [%END%] + [%END%] Required @@ -70,20 +70,20 @@
  • - + Required
  • - + Required
  • + [% END %] +
  • - + Required
  • - + Required
  • --