From 04fea3a53b118dac50700665c8ca814adf30f632 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sat, 18 Mar 2017 18:19:17 +0000 Subject: [PATCH] Bug 17855 - Reverted back to original step 3 in the web installer so there is no basic and advanced setup mode and consequently no need for SQL files to be moved to a 'default' directory for all languages. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Onboarding tool and the rest of the web installer still exists in this commit How I tested in my VM (Current master): - Dropped database - Recreated database - Went through installer - Language en, Marc21 - Installed mandatory data only - Went through Onboarding tool - After finishing, logged in as superlibrarian that was created by onboarding tool Everything worked fine. Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Bug 17855 - Followup patch following requests in comments 176 and 177 Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Bug 17855: perltidy onboarding.pl Signed-off-by: Alex Buckley Signed-off-by: Jonathan Druart Bug 17855: Do not create a new dbh, get it from C4::Context->dbh Signed-off-by: Alex Buckley Signed-off-by: Jonathan Druart Bug 17855: Redirect to the installer if installation process is not done yet Signed-off-by: Alex Buckley Signed-off-by: Jonathan Druart Bug 17855: No need to resend the library list to the template This has been done at the beginning of the script Signed-off-by: Alex Buckley Signed-off-by: Jonathan Druart Bug 17855: Simplify the onboarding tool This patch should not modify a lot the behaviours of the onboarding tool. Its goal is mainly to remove duplicated as well as useless (because copy/pasted from existing script files) code. It assumes that the onboarding tool will be done on an empty database and will skip steps that are not needed. For instance if a library already exists, the first step will be skipped. One of the main problem was the lack of feedback messages sent to the user when something wrong/ok happened. Explanation on main changes: 1. Use checkauth first, then get_template_and_user => As we do not know the template to use, it's better to use checkauth first to know if the user is logged in, then retrieve the template we need, depending on the success or the failure of the action 2. Create a @messages variables Pushing messages to this variable and handling the messages via an include files (onboarding_messages.inc) simplify error handling. Note that we could remove this include file if we merge all the onboardingstepX.tt files altogether 3. Simplify creation of the admnistrator user This patch removes some unecessary checks done on the user's info (passwd to short, mandatory fields Todo (minor): Add style to feedback messages Signed-off-by: Alex Buckley Signed-off-by: Jonathan Druart Bug 17942 - Update style of the web installer with Bootstrap 3 This patch makes style and markup changes to the web installer and new onboarding tool (Bug 17855). - Markup has been corrected, improved, and in many places reindented. - Some page titles have been made more specific. - Some JavaScript and CSS have been moved to separate files. In the onboarding tool I have removed form validation from the markup and JavaScript in many cases where the requirements were not matched elsewhere in Koha. For instance, we shouldn't limit item type descriptions to only letters because the database doesn't require such a limit. To test, apply the patch and run the web installer with an empty database. Confirm that the installation process completes correctly and that each page looks good and works correctly. Signed-off-by: Josef Moravec Signed-off-by: Liz Rea https://bugs.koha-community.org/show_bug.cgi?id=18462 Bug 17942 - Add anti-clickjack code to installer doc head close Signed-off-by: Marc Véron --- installer/install.pl | 17 +- installer/onboarding.pl | 638 ++++++--------------- koha-tmpl/intranet-tmpl/prog/css/installer.css | 229 ++++++++ .../prog/en/includes/installer-doc-head-close.inc | 92 +-- .../prog/en/includes/installer-strings.inc | 7 + .../prog/en/includes/onboarding_messages.inc | 20 + .../prog/en/modules/installer/auth.tt | 93 +-- .../prog/en/modules/installer/step1.tt | 168 +++--- .../prog/en/modules/installer/step2.tt | 129 +++-- .../prog/en/modules/installer/step3.tt | 431 +++++++------- .../prog/en/modules/onboarding/onboardingstep1.tt | 109 ++-- .../prog/en/modules/onboarding/onboardingstep2.tt | 254 ++++---- .../prog/en/modules/onboarding/onboardingstep3.tt | 270 +++------ .../prog/en/modules/onboarding/onboardingstep4.tt | 90 +-- .../prog/en/modules/onboarding/onboardingstep5.tt | 215 ++++--- koha-tmpl/intranet-tmpl/prog/js/onboarding.js | 150 +++++ 16 files changed, 1375 insertions(+), 1537 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/css/installer.css create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/installer-strings.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/onboarding_messages.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/js/onboarding.js diff --git a/installer/install.pl b/installer/install.pl index 4754ac3..b6878e9 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -296,9 +296,6 @@ elsif ( $step && $step == 3 ) { $template->param( "levelloop" => $levellist ); $template->param( "$op" => 1 ); - my $setup = $query->param('setup'); - $template->param( "setup" => $setup ); - } elsif ( $op && $op eq 'choosemarc' ) { # @@ -343,16 +340,12 @@ elsif ( $step && $step == 3 ) { my $marcflavour = C4::Context->preference("marcflavour"); my @flavourlist; foreach my $marc (@listdir) { - my %cell = ( - "label" => ucfirst($marc), - "code" => uc($marc), - "checked" => defined($marcflavour) - ? uc($marc) eq $marcflavour - : 0 - ); - + my %cell=( + "label"=> ucfirst($marc), + "code"=>uc($marc), + "checked"=> defined($marcflavour) ? uc($marc) eq $marcflavour : 0); # $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||""; }; - push @flavourlist, \%cell; + push @flavourlist, \%cell; } $template->param( "flavourloop" => \@flavourlist ); $template->param( "$op" => 1 ); diff --git a/installer/onboarding.pl b/installer/onboarding.pl index 49f4e84..02d4827 100755 --- a/installer/onboarding.pl +++ b/installer/onboarding.pl @@ -17,9 +17,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -#Recommended pragmas use Modern::Perl; -use diagnostics; +use C4::Context; use C4::InstallAuth; use CGI qw ( -utf8 ); use C4::Output; @@ -36,160 +35,80 @@ use Koha::IssuingRules; #Setting variables my $input = new CGI; -my $step = $input->param('step'); -#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 : 1 ) . ".tt", - query => $input, - type => "intranet", - authnotrequired => 0, - debug => 1, - } - ); - -#Check database connection -my %info; -$info{'dbname'} = C4::Context->config("database"); -$info{'dbms'} = ( - C4::Context->config("db_scheme") - ? C4::Context->config("db_scheme") - : "mysql" -); +unless ( C4::Context->preference('Version') ) { + print $input->redirect("/cgi-bin/koha/installer/install.pl"); + exit; +} -$info{'hostname'} = C4::Context->config("hostname"); -$info{'port'} = C4::Context->config("port"); -$info{'user'} = C4::Context->config("user"); -$info{'password'} = C4::Context->config("pass"); -my $dbh = DBI->connect( - "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}" - . ( $info{port} ? ";port=$info{port}" : "" ), - $info{'user'}, $info{'password'} -); +my ( $user, $cookie, $sessionID, $flags ) = + C4::InstallAuth::checkauth( $input, 0, undef, 'intranet' ); +die "Not logged in" + unless $user + ; # Should not happen, we should be redirect if the user is not logged in. But do not trust authentication... -#Store the value of the template input name='op' in the variable $op so we can check if the user has pressed the button with the name="op" and value="finish" meaning the user has finished the onboarding tool. -my $op = $input->param('op') || ''; -$template->param( 'op' => $op ); +my $step = $input->param('step') || 1; +my $op = $input->param('op') || ''; + +my $template_params = {}; +$template_params->{op} = $op; my $schema = Koha::Database->new()->schema(); -if ( $op && $op eq 'finish' ) -{ #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl - print $input->redirect("/cgi-bin/koha/mainpage.pl"); - exit; -} +my @messages; -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' } - ) - ], - }, - ] -); +if ( $step == 1 ) { + if ( $op eq 'add_validate_library' ) { -#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 - my $itemtypes = Koha::ItemTypes->search(); - $template->param( 'itemtypes' => $itemtypes, ); - -if ( $step && $step == 1 ) { - #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; - - #Take the text 'branchname' and store it in the @fields array - my @fields = qw( - branchname - ); - - $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 - $library = Koha::Library->new( - { - branchcode => $branchcode, - ( map { $_ => scalar $input->param($_) || undef } @fields ) - } - ); + my $branchcode = $input->param('branchcode'); + $branchcode = uc($branchcode); - eval { $library->store; }; #Use the eval{} function to store the library object - if ($library) { - $message = 'success_on_insert'; - } - else { - $message = 'error_on_insert'; + $branchcode =~ s|\s||g + ; # Use a regular expression to check the value of the inputted branchcode + + my $library = Koha::Library->new( + { + branchcode => $branchcode, + branchname => scalar $input->param('branchname'), + } + ); + + eval { $library->store; }; + unless ($@) { + push @messages, + { type => 'message', code => 'success_on_insert_library' }; + } + else { + push @messages, + { type => 'message', code => 'error_on_insert_library' }; + } } - $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 + $step++ if Koha::Libraries->count; } -elsif ( $step && $step == 2 ) { - if ($op eq "add_validate_category"){ - #Initialising values - my $searchfield = $input->param('description') // q||; +if ( $step == 2 ) { + if ( $op eq "add_validate_category" ) { + + 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 ); + $template_params->{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; + 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', + dateformat => 'DateTime', dateonly => 1, } ); @@ -204,236 +123,95 @@ elsif ( $step && $step == 2 ) { category_type => $category_type, default_privacy => $default_privacy, enrolmentperiod => $enrolmentperiod, - enrolmentperioddate => $enrolmentperioddate, + enrolmentperioddate => $enrolmentperioddate } ); eval { $category->store; }; - #Error messages - if ($category) { - $message = 'success_on_insert'; + unless ($@) { + push @messages, + { type => 'message', code => 'success_on_insert_category' }; } else { - $message = 'error_on_insert'; + push @messages, + { type => 'message', code => 'error_on_insert_category' }; } - - $template->param( 'message' => $message ); } - #Create a patron -} -elsif ( $step && $step == 3 ) { - my $firstpassword = $input->param('password') || ''; - my $secondpassword = $input->param('password2') || ''; - - #Find all patron records in the database and hand them to the template - my %currentpatrons = Koha::Patrons->search(); - my $currentpatrons = values %currentpatrons; - $template->param( 'patrons' =>$currentpatrons); - - -#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 => [ - { - categorytype => 'searchdomain', - categories => [ - Koha::LibraryCategories->search( - { categorytype => 'searchdomain' } - ) - ], - }, - { - categorytype => 'properties', - categories => [ - Koha::LibraryCategories->search( - { categorytype => 'properties' } - ) - ], - }, - ] - ); - -#Find all patron categories in the database and hand them to the template to display in the patron category dropdown box - my $categories = Koha::Patron::Categories->search(); - $template->param( 'categories' => $categories, ); - -#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry - - my $existing_cardnumber = $schema->resultset('Borrower')->get_column('cardnumber')->max() // 0; - - my $new_cardnumber = $existing_cardnumber + 1; - $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 $cardnumber = $input->param('cardnumber'); - my $borrowernumber = $input->param('borrowernumber'); - my $userid = $input->param('userid'); - - # function to designate mandatory fields (visually with css) - my $check_BorrowerMandatoryField = - C4::Context->preference("BorrowerMandatoryField"); - my @field_check = split( /\|/, $check_BorrowerMandatoryField ); - foreach (@field_check) { - $template->param( "mandatory$_" => 1 ); - $template->param( - BorrowerMandatoryField => - C4::Context->preference("BorrowerMandatoryField") - , #field to test with javascript - ); - } - - #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' - : (); - } - - #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 ); + $step++ if Koha::Patron::Categories->count; +} +if ( $step == 3 ) { + if ( $op eq 'add_validate_patron' ) { + + #Create a patron + my $firstpassword = $input->param('password') || ''; + my $secondpassword = $input->param('password2') || ''; + my $cardnumber = $input->param('cardnumber'); + my $userid = $input->param('userid'); + + if ( my $error_code = checkcardnumber($cardnumber) ) { + if ( $error_code == 1 ) { + push @messages, + { + type => 'alert', + code => 'ERROR_cardnumber_already_exists' + }; } - if ( $error eq 'ERROR_short_password' ) { - $template->param( errorshortpassword => 1 ); + elsif ( $error_code == 2 ) { + push @messages, + { type => 'alert', code => 'ERROR_cardnumber_length' }; } } - $template->param( 'nok' => 1 ); + elsif ( $firstpassword ne $secondpassword ) { -#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", - authnotrequired => 0, - flagsrequired => { borrowers => 1 }, - debug => 1, - } - ); - - if ( $op eq 'add_validate' ) { - my %newdata; - - #Store the template form values in the newdata hash - $newdata{borrowernumber} = $input->param('borrowernumber'); - $newdata{surname} = $input->param('surname'); - $newdata{firstname} = $input->param('firstname'); - $newdata{cardnumber} = $input->param('cardnumber'); - $newdata{branchcode} = $input->param('libraries'); - $newdata{categorycode} = $input->param('categorycode_entry'); - $newdata{userid} = $input->param('userid'); - $newdata{password} = $input->param('password'); - $newdata{password2} = $input->param('password2'); - $newdata{privacy} = "default"; - $newdata{address} = ""; - $newdata{city} = ""; - -#Hand tne the dateexpiry of the patron based on the patron category it is created from - my $patron_category = Koha::Patron::Categories->find( $newdata{categorycode} ); - $newdata{dateexpiry} = $patron_category->get_expiry_date( $newdata{dateenrolled} ); - -#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 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'); - my %all_module_perms = (); - my %sub_perms = (); - foreach my $perm (@perms) { - if ( $perm !~ /:/ ) { - $all_module_perms{$perm} = 1; - } - else { - my ( $module, $sub_perm ) = split /:/, $perm, 2; - push @{ $sub_perms{$module} }, $sub_perm; - } - } - - # construct flags - my @userflags = $schema->resultset('Userflag')->search({},{ - order_by => { -asc =>'bit'}, - } - ); - -#Setting superlibrarian permissions for new patron - my $flags = Koha::Patrons->find($borrowernumber)->set({flags=>1})->store; + push @messages, + { type => 'alert', code => 'ERROR_password_mismatch' }; + } + else { - #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' }; - } + my $patron_data = { + surname => scalar $input->param('surname'), + firstname => scalar $input->param('firstname'), + cardnumber => scalar $input->param('cardnumber'), + branchcode => scalar $input->param('libraries'), + categorycode => scalar $input->param('categorycode_entry'), + userid => scalar $input->param('userid'), + password => scalar $input->param('password'), + password2 => scalar $input->param('password2'), + privacy => "default", + address => "", + city => "", + flags => 1, # Will be superlibrarian + }; + + my $patron_category = + Koha::Patron::Categories->find( $patron_data->{categorycode} ); + $patron_data->{dateexpiry} = + $patron_category->get_expiry_date( $patron_data->{dateenrolled} ); + + my $borrowernumber = C4::Members::AddMember(%$patron_data); + + #Error handling checking if the patron was created successfully + if ($borrowernumber) { + push @messages, + { type => 'message', code => 'success_on_insert_patron' }; + } + else { + push @messages, + { type => 'error', code => 'error_on_insert_patron' }; } } } + + $step++ if Koha::Patrons->search( { flags => 1 } )->count; } -elsif ( $step && $step == 4 ) { - my ( $template, $borrowernumber, $cookie ) = - C4::InstallAuth::get_template_and_user( - { - template_name => "/onboarding/onboardingstep4.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => - { parameters => 'parameters_remaining_permissions' }, - debug => 1, - } - ); - if ($op eq "add_validate"){ +if ( $step == 4 ) { + if ( $op eq 'add_validate_itemtype' ) { 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, @@ -441,93 +219,29 @@ elsif ( $step && $step == 4 ) { } ); 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'; + unless ($@) { + push @messages, + { type => 'message', code => 'success_on_insert_itemtype' }; } else { - $message = 'error_on_insert'; + push @messages, + { type => 'message', code => 'error_on_insert_itemtype' }; } - $template->param( 'message' => $message ); } + + $step++ if Koha::ItemTypes->count; } -elsif ( $step && $step == 5 ) { - - #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 $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, - } - ); - - #If no libraries exist then set the $branch value to * - my $branch = $input->param('branch'); - 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() || '*' ) - : '*'; - } - } - $branch = '*' if $branch eq 'NO_LIBRARY_SET'; - my $op = $input->param('op') || q{}; +if ( $step == 5 ) { + + if ( $op eq 'add_validate_circ_rule' ) { + + #If no libraries exist then set the $branch value to * + my $branch = $input->param('branch') || '*'; - if ( $op eq 'add_validate' ) { my $type = $input->param('type'); - my $br = $input->param('branch'); - my $bor = $input->param('categorycode'); + my $branchcode = $input->param('branch'); + my $categorycode = $input->param('categorycode'); my $itemtype = $input->param('itemtype'); my $maxissueqty = $input->param('maxissueqty'); my $issuelength = $input->param('issuelength'); @@ -540,8 +254,8 @@ elsif ( $step && $step == 5 ) { $issuelength = $issuelength eq q{} ? undef : $issuelength; my $params = { - branchcode => $br, - categorycode => $bor, + branchcode => $branchcode, + categorycode => $categorycode, itemtype => $itemtype, maxissueqty => $maxissueqty, renewalsallowed => $renewalsallowed, @@ -551,53 +265,65 @@ elsif ( $step && $step == 5 ) { onshelfholds => $onshelfholds, }; - my @messages; + my $issuingrule = Koha::IssuingRule->new($params); + eval { $issuingrule->store; }; -#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to. - if ( $branch eq "*" ) { - my $search_default_rules = $schema->resultset('DefaultCircRule')->count(); - my $insert_default_rules = $schema->resultset('Issuingrule')->new( - { maxissueqty => $maxissueqty, onshelfholds => $onshelfholds } - ); + unless ($@) { + push @messages, + { type => 'message', code => 'success_on_insert_circ_rule' }; } -#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to. - elsif ( $bor eq "*" ) { - - my $search_default_rules = $schema->resultset('DefaultCircRule')->count(); - my $insert_default_rules = $schema->resultset('Issuingrule')->new( - { maxissueqty => $maxissueqty} - ); + else { + push @messages, + { type => 'message', code => 'error_on_insert_circ_rule' }; } + } -#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to - elsif ( $itemtype eq "*" ) { - my $search_default_rules = $schema->resultset('DefaultCircRule')->search({},{ - branchcode => $branch - } + $step++ if Koha::IssuingRules->count; +} - ); +my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); +$template_params->{libraries} = $libraries; +$template_params->{group_types} = [ + { + categorytype => 'searchdomain', + categories => [ + Koha::LibraryCategories->search( + { categorytype => 'searchdomain' } + ) + ], + }, + { + categorytype => 'properties', + categories => [ + Koha::LibraryCategories->search( { categorytype => 'properties' } ) + ], + }, +]; + +if ( $step > 5 ) { + $template_params->{all_done} = 1; # If step 5 is complete, we are done! + $step = 5; +} - my $insert_default_rules = $schema->resultset('Issuingrule')->new( - { branchcode => $branch, onshelfholds => $onshelfholds } - ); - } +#Getting the appropriate template to display to the user +my ( $template, $loggedinuser ); +( $template, $loggedinuser, $cookie ) = C4::InstallAuth::get_template_and_user( + { + template_name => "onboarding/onboardingstep${step}.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + debug => 1, + } +); - 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. +$template_params->{messages} = \@messages; +my $categories = Koha::Patron::Categories->search(); +$template_params->{categories} = $categories; - } - else { - Koha::IssuingRule->new()->set($params)->store(); - } - } -} +my $itemtypes = Koha::ItemTypes->search(); +$template_params->{itemtypes} = $itemtypes; + +$template->param(%$template_params); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/css/installer.css b/koha-tmpl/intranet-tmpl/prog/css/installer.css new file mode 100644 index 0000000..374c56d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/css/installer.css @@ -0,0 +1,229 @@ +body { + background-color: #EEE; + text-align: left; + font-family: arial, verdana, helvetica, sans-serif; +} + +h1 { + font-size: 161.6%; + font-weight: bold; +} + +h2 { + background-color: #eee; + border-radius: 4px; + font-size: 146.5%; + font-weight: bold; + text-shadow: 1px 1px 0px #FFF; + padding: .5em; +} + +h3 { + color: #003366; + font-size: 131%; + font-weight: bold; +} + +hr { + margin-top: .5em; + margin-bottom: .5em; +} + +.installer-main { + background-color: #FFF; + border-radius: 5px; + margin-top: 3%; + margin-bottom: 3%; + padding: 1em; + -webkit-box-shadow: 0px 2px 2px 0px rgba(50, 50, 50, 0.5); + -moz-box-shadow: 0px 2px 2px 0px rgba(50, 50, 50, 0.5); + box-shadow: 0px 2px 2px 0px rgba(50, 50, 50, 0.5); +} + +ul, ol { padding: 5px 5px 5px 20px; } + +#logo { + background: url(../img/koha-logo.gif) no-repeat top center; + margin-top: 0; + margin-bottom: .5em; +} + +#logo a { + display: block; + text-indent: -1000px; + height: 74px; + border-bottom: none; +} + +.bg-danger { + padding: .2em .4em; +} + +.step a, .step input { font-size: 2em; } + +td input { font-size: 1.5em; } + +.step, th { text-align: right; } + +#bloc25, .bloc25 { + float:left; + border:1px solid #000000; + margin:0px; + padding:0px; + +} + +#footer { + text-align: center; + border-top: 1px solid #ccc; + padding-top: 1em; + font-style: italic; +} + +.update_error { + color: red; + font-weight: bold; +} + +.checkbox { + margin-bottom: 1em; +} + +fieldset.rows { + border-width: 0; + float: left; + font-size: 90%; + clear: left; + margin: .9em 0 0 0; + padding: 0; + width: 100%; +} + +fieldset.rows legend { + border: 0; + margin-left: 1em; + font-weight: bold; + font-size: 110%; + margin-bottom: 0; +} + +fieldset.rows label, +fieldset.rows span.label { + float: left; + font-weight: bold; + width: 9em; + margin-right: 1em; + text-align: right; +} + +fieldset.rows span.label { + display: inline; + padding: .2em .6em .3em; + font-size: inherit; + font-weight: bold; + line-height: 1; + color: inherit; + text-align: right; + white-space: normal; + vertical-align: baseline; + border-radius: 0; +} + +fieldset.rows fieldset { + background-color: transparent; + border-width: 1px; + margin: 1em; + padding: .3em; +} + +fieldset.rows ol { + padding: 1em 1em 0 1em; + list-style-type: none; +} + +fieldset.rows li { + float: left; + clear: left; + padding-bottom: 1em; + list-style-type: none; + width: 100%; +} + +fieldset.rows .hint { + margin-left: 10.5em; + margin-right: 4em; + margin-top: .5em; + font-size: 96%; + color: #666; +} + +fieldset.rows label.error { + color: #cc0000; + float: none; + margin-left: 1em; + width: auto; +} + +fieldset.rows ol { + padding: 0 1em 0 1em; +} + + +label.required, +span.required { + color : #C00; +} + +span.required { + font-style : italic; + margin-left : .5em; +} + +.breadcrumbs { + background-color: #e6f0f2; + margin: 1em 0; + padding: .4em 2em; +} + +/* Override core jQueryUI widgets */ +.ui-widget-content { border: 1px solid #B9D8D9; background: #ffffff none; color: #222222; } +.ui-widget-header { border: 1px solid #B9D8D9; background: #E6F0F2 none; color: #222222; font-weight: bold; } +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #B9D8D9; background: #F4F8F9 none; font-weight: normal; color: #555555; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #B9D8D9; background: #E6F0F2 none; font-weight: normal; color: #212121; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff none; font-weight: normal; color: #212121; } +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #FED22F; background: #FFF4C6; color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec; color: #cd0a0a; } + +.ui-widget, +.ui-widget input, +.ui-widget select, +.ui-widget textarea, +.ui-widget button { + font-family : inherit; + font-size : inherit; +} + +/* jQuery UI Datepicker */ +.ui-datepicker table { + width: 100%; + font-size: .9em; + border : 0; + border-collapse: collapse; + margin:0 0 .4em; +} + +.ui-datepicker th { + background : transparent none; + padding: .7em .3em; + text-align: center; + font-weight: bold; + border: 0; +} + +.ui-datepicker-trigger { + vertical-align: middle; + margin : 0 3px; +} +.ui-datepicker { + box-shadow: 1px 1px 3px 0 #666; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc index 60d0e66..ee7af5f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc @@ -2,92 +2,28 @@ - - - + - - - - - - - - + +[%# Prevent XFS attacks -%] + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/installer-strings.inc new file mode 100644 index 0000000..21b8245 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/installer-strings.inc @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboarding_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboarding_messages.inc new file mode 100644 index 0000000..67eabef --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/onboarding_messages.inc @@ -0,0 +1,20 @@ +[% FOR m IN messages %] +
+ [% SWITCH m.code %] + [% CASE 'success_on_insert_library' %]Library created! + [% CASE 'error_on_insert_library' %]Library already exists and cannot be modified! + [% CASE 'success_on_insert_category' %]Patron category created! + [% CASE 'error_on_insert_category' %]Patron category already exists and cannot be modified! + [% CASE 'success_on_insert_patron' %]Administrator Patron created! + [% CASE 'error_on_insert_patron' %]The patron has not been created! Cardnumber or Userid may already exist. + [% CASE 'ERROR_cardnumber_already_exists' %]Cardnumber already in use. + [% CASE 'ERROR_cardnumber_length' %]Cardnumber length is incorrect. + [% CASE 'ERROR_password_mismatch' %]Passwords do not match. + [% CASE 'success_on_insert_itemtype' %]New item type created! + [% CASE 'error_on_insert_itemtype' %]Item type already exists! + [% CASE 'success_on_insert_circ_rule' %]Circulation rule created! + [% CASE 'error_on_insert_circ_rule' %]Circulation rule not created! + [% CASE %][% message %] + [% END %] +
+[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt index c3509cd..28d95ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt @@ -1,52 +1,63 @@ [% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] -Koha › +<title>Koha › [% IF ( nopermission ) %]Access denied[% END %] [% IF ( timed_out ) %]Session timed out[% END %] [% IF ( different_ip ) %]IP address change[% END %] [% IF ( invalid_username_or_password ) %]Invalid username or password[% END %] - [% IF ( loginprompt ) %]Log in to Koha[% END %] + [% IF ( loginprompt ) %]Log in to the Koha web installer[% END %] [% INCLUDE 'installer-doc-head-close.inc' %] -
-

Koha [%- Koha.Version.release -%] installer

-[% IF ( nopermission ) %] -
Error: Unauthorized user click to log out
-[% END %] - -[% IF ( timed_out ) %] -
Error: Session timed out, please log in again
-[% END %] - -[% IF ( different_ip ) %] -
Error: IP address has changed, please log in again
-[% END %] - -[% IF ( invalid_username_or_password ) %] -
Error: Invalid username or password
-[% END %] - -[% IF ( loginprompt ) %] - -
-[% FOREACH INPUT IN INPUTS %] - -[% END %] -

Welcome to the Koha web installer

-

Before we begin, please verify you have the correct credentials to continue. Please log in -with the username and password given to you by your systems administrator and located in your -koha-conf.xml configuration file.

-

Please enter your username and password:

-

-

-

-

-

-
- -[% END %] +
+
+
+ +

Koha

+ + [% IF ( nopermission ) %] +
Error: Unauthorized user click to log out
+ [% END %] + + [% IF ( timed_out ) %] +
Error: Session timed out, please log in again
+ [% END %] + + [% IF ( different_ip ) %] +
Error: IP address has changed, please log in again
+ [% END %] + + [% IF ( invalid_username_or_password ) %] +
Error: Invalid username or password
+ [% END %] + + [% IF ( loginprompt ) %] +

Welcome to the Koha [%- Koha.Version.release -%] web installer

+ +

Before we begin, please verify you have the correct credentials to continue. Please log in with the username and password given to you by your systems administrator and located in your koha-conf.xml configuration file.

+ +
+ [% FOREACH INPUT IN INPUTS %] + + [% END %] + +
+ Please enter your username and password + +
+ + +
+
+ + +
+

+
+
+ [% END %] +
+
+
[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step1.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step1.tt index 89da761..9647ae9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step1.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step1.tt @@ -1,82 +1,98 @@ [% INCLUDE 'doc-head-open.inc' %] -Koha › Web installer › Step 1 -[% INCLUDE 'installer-doc-head-close.inc' %] -
-

Koha Web installer › Step 1

-[% UNLESS ( language ) %] -

You are about to install Koha.

- -

Please pick your language from the following list. If your language is not -listed, please inform your systems administrator.

-
- -

- -

Click 'Next' to continue

-
-[% END %] -[% IF ( language ) %] - [% IF ( checkmodule ) %] -

All required Perl modules appear to be installed.
- [% ELSE %] - [% IF ( missing_modules ) %] -

Warning: Some Perl modules are missing.
Modules in red must be installed before you may continue.
-

    - [% FOREACH missing_module IN missing_modules %] - [% IF ( missing_module.require ) %] -
  • [% missing_module.name %] - [% ELSE %] -
  • [% missing_module.name %] + Check Perl dependencies [% END %] -
    Version: [% missing_module.version %] -
    Usage: [% missing_module.usage %] -
  • - [% END %] - [% END %] - [% IF ( problems ) %] -

    I encountered some problems.

    -
      - [% IF ( perlversion ) %] -
    • Your Perl version seems to be obsolete. - Please upgrade to a newer version of Perl (at least Version 5.10).
    • - [% END %] -
    - [% END %] - [% END %] -
    -[% IF ( checkmodule ) %] -[% IF (op == 'noop') %] - -[% ELSE %] - - - -[% END %] -

    All dependencies installed.

    -

    Please click 'Next' to continue

    -[% ELSE %] -[% IF (op == 'noop') %] - -[% ELSE %] - - -[% END %] -

    Click to recheck dependencies

    -[% END %] -
    -[% END %] + +[% INCLUDE 'installer-doc-head-close.inc' %] + +
    +
    +
    + +

    Koha

    + + [% UNLESS ( language ) %] +

    Web installer › Choose your language

    +

    You are about to install Koha.

    + +

    Please pick your language from the following list. If your language is not listed, please inform your system administrator.

    + +
    +
    + + +
    + +

    +
    + [% END %] + + [% IF ( language ) %] + [% UNLESS ( checkmodule ) %] + [% IF ( missing_modules ) %] +

    Web installer › Perl modules missing

    +

    Some Perl modules are missing. Required modules must be installed before you may continue.
    +

      + [% FOREACH missing_module IN missing_modules %] +
    • [% missing_module.name %] [% IF ( missing_module.require ) %]Required[% END %] +
      Version: [% missing_module.version %] +
      Usage: [% missing_module.usage %] +
    • + [% END %] +
    + [% END %] + + [% IF ( problems ) %] +

    Web installer › Perl version too old

    +

    I encountered some problems.

    +
      + [% IF ( perlversion ) %] +
    • Your Perl version is out of date. Please upgrade to a newer version of Perl (at least version 5.10).
    • + [% END %] +
    + [% END %] + +
    + +

    +
    + + [% ELSE # IF checkmodule %] +

    Web installer › Check Perl dependencies

    +

    All required Perl modules appear to be installed.

    +

    All dependencies installed.

    + +
    + +

    +
    + [% END # IF checkmodule%] + [% END # IF language %] +
    +
    + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step2.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step2.tt index d7194b9..aaea508 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step2.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step2.tt @@ -1,63 +1,70 @@ -[% INCLUDE 'doc-head-open.inc' %]Koha › Web installer › Step 2 +[% INCLUDE 'doc-head-open.inc' %]Koha › Web installer › Database settings [% INCLUDE 'installer-doc-head-close.inc' %] -
    -

    Koha Web installer › Step 2

    -

    Database settings:

    -
      -
    • database type : [% dbms %]
    • -
    • database name : [% dbname %]
    • -
    • database host : [% hostname %]
    • -
    • database port : [% port %] (probably OK if blank)
    • -
    • database user : [% user %]
    • -
    -
    -[% IF ( dbconnection ) %] -
    - [% IF ( checkdatabaseaccess ) %] -

    Connection established.

    - [% IF ( checkdatabasecreated ) %] -

    Database [% dbname %] exists.

    - [% IF ( checkgrantaccess ) %] -

    User [% user %] has all required privileges on database [% dbname %].

    - [% ELSE %] -

    user [% user %] doesn't have enough privilege on database [% dbname %]

    -

    Ask for or make a change in the user's privileges. Need help? See - [% IF dbms == 'mysql' %] - [% ELSE %] - [% END %]this page. -

    -

    - User [% user %] must have USAGE, INSERT, UPDATE, DELETE, DROP and CREATE privileges on [% dbname %] -

    - [% END %] - [% ELSE %] -

    No database named [% dbname %] detected.

    -

    Please create the database before continuing.

    - [% END %] - [% ELSE %] -
    [% error %] : [% message %] + +
    +
    +
    + +

    Koha

    +

    Web installer › Database settings

    +

    Database settings:

    +
      +
    • Database type : [% dbms %]
    • +
    • Database name : [% dbname %]
    • +
    • Database host : [% hostname %]
    • +
    • Database port : [% port %] (probably okay if blank)
    • +
    • Database user : [% user %]
    • +
    + + [% IF ( dbconnection ) %] + + [% IF ( checkdatabaseaccess ) %] + + [% IF ( checkdatabasecreated ) %] +
      +
    • Database [% dbname %] exists.
    • + [% IF ( checkgrantaccess ) %] +
    • User [% user %] has all required privileges on database [% dbname %].
    • +
    + [% ELSE %] +
+

user [% user %] doesn't have enough privilege on database [% dbname %]

+

Ask for or make a change in the user's privileges. Need help? See [% IF ( mysql ) %] + + [% ELSE %] + + [% END %] + this page. User [% user %] must have USAGE, INSERT, UPDATE, DELETE, DROP and CREATE privileges on [% dbname %] +

+ [% END %] + [% ELSE %] + +

Please create the database before continuing.

+ [% END %] + [% ELSE %] + +
+
    +
  • Check that your database is running.
  • +
  • Check your database settings in koha-conf.xml.
  • +
  • Check the hostname setting in koha-conf.xml. + Some database servers require 127.0.0.1 rather than localhost.
  • +
+
+

Please correct these errors and start the installer again. + [% END %] + [% UNLESS ( error ) %] + +

+ [% END %] + + [% ELSE %] +
+ + +

+
+ [% END %] +
-
-
    -
  • Check that your database is running.
  • -
  • Check your database settings in koha-conf.xml.
  • -
  • Check the hostname setting in koha-conf.xml. - Some database servers require 127.0.0.1 rather than localhost.
  • -
-

Please correct these errors and start the installer again. - [% END %] - [% IF ( error ) %][% ELSE %] - -

Click 'Next' to continue

-[% END %] - -[% ELSE %] -
- - -

Please click 'Next' to continue if this information is correct

-
-[% END %] - - - +[% INCLUDE 'intranet-bottom.inc' %] 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 bb2111b..84f40e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt @@ -1,218 +1,179 @@ -[% INCLUDE 'doc-head-open.inc' %]Koha › Web installer › Step 3 -[% IF ( finish ) %][% END %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Web installer › + [% IF ( proposeimport ) %] + Set up database + [% END %] + [% IF ( importdatastructure ) %] + [% IF ( error ) %] + Error creating database tables + [% ELSE %] + Database tables created + [% END %] + [% END %] + [% IF ( default ) %] + [% IF ( upgrading ) %] + Update database + [% ELSE %] + Install basic configuration settings + [% END %] + [% END %] + [% IF ( choosemarc ) %] + Select your MARC flavor + [% END %] + [% IF ( selectframeworks ) %] + Selecting default settings + [% END %] + +[% IF ( finish ) %][% END %] [% INCLUDE 'installer-doc-head-close.inc' %] -
-

Koha Koha web installer › Step 3

- -[% IF ( selectframeworks ) %] - -[% END %] + [% IF ( selectframeworks ) %] +

Web installer › [% setup %] setup › Selecting default settings

+ [% IF setup == "Advanced" %] +

Select all sample data

+ [% END %] -[% IF ( finish ) %] -

Congratulations, installation complete

-

If this page does not redirect in 10 seconds, click Start onboarding process.

+[% IF ( choosemarc ) %] +

Select your MARC flavor

+
+ + +

+ [% FOREACH flavourloo IN flavourloop %] +

+ [% IF ( flavourloo.checked ) %] + [% flavourloo.label %]
+ [% ELSE %] + [% flavourloo.label %]
+ [% END %] +
+ [% END %] +

+

Click 'Next' to continue

+
[% END %] - -[% IF ( choosemarc ) %] -

Choose your setup

-

Basic setup selects recommended settings by default.

+[% IF ( selectframeworks ) %] +

Selecting Default Settings

+
- + + [% IF ( frameworksloop ) %] +

MARC frameworks: [% marcflavour %]

+ [% IF ( en_marc_frameworks ) %] +

No MARC frameworks are available for your language. + Defaulting to the frameworks supplied for English (en)

+ [% END %] + [% FOREACH frameworksloo IN frameworksloop %]
- Basic
- Advanced
-
- -

Select your MARC flavor

-

MARC stands for Machine Readable Cataloging, containing information about a bibliographic record. MARC21 is more commonly used globally, whereas UNIMARC tends to be used in Europe.

- - [% FOREACH flavourloo IN flavourloop %] -
- [% IF ( flavourloo.label == "Unimarc") %] - [% flavourloo.label %]
+

[% frameworksloo.label %]

+ [% FOREACH framework IN frameworksloo.frameworks %] + + + + +
+ [% IF ( framework.checked ) %] + + [% ELSE %] + + [% END %] + + +
+ [% END %] +
+ [% END %] +

Other data

+ [% END %] + [% IF ( en_sample_data ) %] +

No sample data and settings are available for your language. + Defaulting to the samples supplied for English (en)

+ [% END %] + [% FOREACH levelloo IN levelloop %] +
+

[% levelloo.label %]

+ [% FOREACH framework IN levelloo.frameworks %] + + + + +
+ [% IF ( framework.checked ) %] + [% ELSE %] - [% flavourloo.label %]
+ [% END %] - - [% END %] - -

Click 'Next' to continue

- - - -[% END %] - -[% IF ( selectframeworks ) %] -

[% setup %] setup

-

Selecting Default Settings

- - [% IF setup == "Advanced" %] - - [% END %] -
- - - [% IF ( frameworksloop ) %] -

MARC frameworks: [% marcflavour %]

- [% IF ( en_marc_frameworks ) %] -

No MARC frameworks are available for your language. - Defaulting to the frameworks supplied for English (en)

- [% END %] - [% FOREACH frameworksloo IN frameworksloop %] -
-

[% frameworksloo.label %]

- [% FOREACH framework IN frameworksloo.frameworks %] - - - - - [% ELSE %] - - [% END %] - -
- [% IF (frameworksloo.label == "Default") && (setup=="Basic") %] - - [% ELSE %] - - [% END %] - - [% IF (frameworksloo.label == "Default") && (setup=="Basic") %] -
    -
  • - -
  • -
-
- -
- [% END %] -
- [% END %] -

Other data

- [% END %] - [% IF ( en_sample_data ) %] -

No sample data and settings are available for your language. - Defaulting to the samples supplied for English (en)

- [% END %] - [% FOREACH levelloo IN levelloop %] -
-

[% levelloo.label %]

- - [% IF (setup == "Basic" && levelloo.label == "Optional") %] - - [% END %] - - [% FOREACH framework IN levelloo.frameworks %] - - - - - [% ELSE %] - - [% END %] - -
- [% IF (levelloo.label == "Default" ) && (setup=="Basic")%] - - [% ELSE %] - - [% END %] - - [% IF (levelloo.label == "Default") && (setup=="Basic")%] -
    -
  • - -
  • -
-
- -
- [% END %] -
- [% END %] -

When you've made your selections, please click 'Import' below to begin the process. It may take a while to complete, - please be patient.

-

-

-
+
+ +
+ [% END %] +
+ [% END %] +

When you've made your selections, please click 'Import' below to begin the process. It may take a while to complete, + please be patient.

+

+

+ [% END %] @@ -241,49 +202,59 @@ function Hide(link)

[% END %] + [% IF ( proposeimport ) %] +

Web installer › Set up database

+

Now we're ready to create the database tables and fill them with some default data.

+
+ + +

+
+ [% END %] -[% IF ( importdatastructure ) %] - [% IF ( error ) %] -

The following error occurred while importing the database structure:

-

[% error %]

-

Please contact your system administrator

- [% ELSE %] -

Success

-
    -
  • Database tables created
  • -
-
- -

Click 'Next' to continue

-
- [% END %] -[% END %] - + [% IF ( default ) %] + [% IF ( upgrading ) %] +

Web installer › Update database

+

We are upgrading from Koha [% dbversion %] to [% kohaversion %]

+

Update your database

+ [% ELSE %] +

Web installer › Install basic configuration settings

+

We are ready to do some basic configuration.

+

Continue to the next step

+ [% END %] + [% END %] -[% IF ( proposeimport ) %] -

Now we're ready to create the database tables and fill them with some default data.

-
- - -

Click 'Next' to continue

-
-[% END %] + [% IF ( updatestructure ) %] +

Updating database structure

+ [% IF ( has_update_succeeds ) %] +

Update report :

+
    + [% FOREACH update_repor IN update_report %] +
  • [% update_repor.line |html %]
  • + [% END %] +
+ [% END %] [% IF ( default ) %] [% IF ( upgrading ) %]

We are upgrading from Koha [% dbversion %] to [% kohaversion %], you must update your database.
- + Update your database

[% ELSE %]

We are ready to do some basic configuration. Please install some basic configuration settings to continue the installation:

- + Install basic configuration settings - [% END %] -[% END %] + [% UNLESS ( has_update_errors ) %] +

Everything went okay. Update done.

+ [% END %] +

Continue to log in to Koha

+ [% END # / IF updatestructure %] +
+ [% IF ( updatestructure ) %]

Updating database structure

@@ -306,10 +277,8 @@ function Hide(link) [% UNLESS ( has_update_errors ) %]

Everything went OK, update done.

[% END %] - +Continue to log in to Koha
[% END %] - - - +[% INCLUDE 'intranet-bottom.inc' %] 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 b295fc9..9754f74 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt @@ -1,81 +1,38 @@ - [% INCLUDE 'doc-head-open.inc' %] [% INCLUDE 'installer-doc-head-close.inc' %] [% INCLUDE 'datatables.inc' %] -[% IF (libraries && libraries.count > 1) %] - - -[% ELSIF (op == "add_validate_library") %] - - Welcome › to › Koha - - - -
-

Koha Welcome to Koha

-
- - - [% IF message == "success_on_insert" %] -
- -

New library

-
-

Success: library created! -

-

To add another library and for more settings,
- go to:
- More -> Administration -> Libraries and groups
-

-
- Next up: - -
- - [%ELSE %] -
- -

Failed

-
-

Library was not successfully created
- Please try again or contact your system administrator.

-
- -
- [%END%] - -[% ELSE %] - - Welcome › to › Koha - - - -
-

Koha Welcome to Koha

-
- - -
-
-

Create a library

- - -
    -
  1. - - - Required -
  2. -
  3. - - - Required -
  4. -
-
- -
-
-[% END %] +Welcome › to › Koha + +
+

Koha Welcome to Koha

+
+ +[% INCLUDE 'onboarding_messages.inc' %] + +
+
+

Create a library

+ + +
    +
  1. + + + Required +
  2. +
  3. + + + Required +
  4. +
+

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

+ +
+
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 f0e90aa..673cbb9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt @@ -2,163 +2,113 @@ [% USE KohaDates %] [% USE Price %] [% INCLUDE 'doc-head-open.inc' %] - Add a patron category +Koha › Web installer › Add a patron category +[% IF (categories && categories.count > 1 ) + # This if statement checks if the categories variable handed to this template + # by onboarding.pl has data in it. If the categories variable does have data + # in it this means that the user has previously imported sample patron category + # data and so we do not need to show them the create patron category screen 1, + #instead we can display a screen with ubtton redirecting the user to step 3 %] + +[% END %] [% INCLUDE 'installer-doc-head-close.inc' %] -[% INCLUDE 'calendar.inc' %] [% INCLUDE 'js_includes.inc' %] -[% INCLUDE 'datatables.inc' %] - - +[% INCLUDE 'validator-strings.inc' %] +[% INCLUDE 'installer-strings.inc' %] + -[% IF (categories && categories.count > 1 ) %] +
+

Koha Welcome to Koha

+
- - - -[% ELSIF (op == "add_validate_category") %] - - -
-

Koha Welcome to Koha

-
- - [% IF message != "error_on_insert" %] -
- -

New patron category

-
-

Success: patron category created!

-

To add another patron category and for more settings
- go to:
- More -> Administration -> Patron categories
-

- Next up:
- -
- [% ELSE %] -
- Message is [% message %] +[% INCLUDE 'onboarding_messages.inc' %] +

Create a new patron category

+

The patron category you create in this form is going to be the one which the new administrator patron account will have.

+ +
-

Failed

-
Patron category was not successfully created.
- Please try again or contact your system administrator.

-
- - - [% END %] - - -[% ELSE %] -
-

Koha Welcome to Koha

-
- -

Create a new patron category

-

The patron category you create in this form is going to be the one which the new administrator patron account will have.

-
-
- - -
    -
  1. - - - Required -
  2. - -
  3. - - - Required -
  4. - -
  5. - - -
  6. - -
  7. - - - Required -
  8. - -
  9. - - -

    Controls how long a patrons checkout history is kept for new patrons of this category. "Never" anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob batch_anonymise.pl which should be set up by your system administrator.

    -
  10. -
- Enrolment period: -
-
- Choose one -
    -
  1. - - months -
  2. -
  3. - - -
  4. -
-
-
- -
-
-[% END %] + +
    +
  1. + + + Required +
  2. + +
  3. + + + Required +
  4. + +
  5. + + +
  6. + +
  7. + + Staff +
  8. + +
  9. + + +

    Controls how long a patrons checkout history is kept for new patrons of this category. "Never" anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob batch_anonymise.pl which should be set up by your system administrator.

    +
  10. +
+ Enrolment period: +
+
+ Choose one +
    +
  1. + + months +
  2. +
  3. + + +
  4. +
+
+

Success: patron category created!

+

To add another patron category and for more settings
+ go to:
+ More -> Administration -> Patron categories
+ + +

+ [% INCLUDE 'intranet-bottom.inc' %] 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 de2e595..1f04a98 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt @@ -1,196 +1,102 @@ -[% USE Koha %] -[% USE KohaDates %] -[% USE Price %] [% INCLUDE 'doc-head-open.inc' %] -[% IF ( finish ) %][% END%] [% INCLUDE 'installer-doc-head-close.inc' %] -[% INCLUDE 'calendar.inc' %] -[% INCLUDE 'datatables.inc' %] [% INCLUDE 'js_includes.inc' %] +[% INCLUDE 'validator-strings.inc' %] +[% INCLUDE 'installer-strings.inc' %] - -Create Koha administrator patron - - - -
-

Koha Welcome to Koha

-
+ +[% INCLUDE 'onboarding_messages.inc' %] + +

Create koha administrator patron

+

+Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions. +

+
+
+ + + Library management +
    +

    Patron identity

    +
  1. + + + Required +
  2. +
  3. + + + Required +
  4. +
+
    +
  1. + + [% IF patrons && patrons > 1 %] + + [% ELSE %] + + [% END %] + Required +
  2. +
  3. -[% IF (nok) %] - - -

    There was an error

    -

    Try again

    -
    -
      - [% IF errorloginexists %] -
    • Username/password already exists.
    • - [% END %] - [% IF errorcardnumberexists %] -
    • Cardnumber already in use.
    • - [% END %] - [% IF errorcardnumberlength %] -
    • Cardnumber length is incorrect
    • - [% END %] - [% IF errorshortpassword %] -
    • Password length is incorrect, must be at least [% minPasswordLength %] characters long.
    • - [% END %] - [% IF errorpasswordmismatch %] -
    • Passwords do not match.
    • - [% END %] -
    + + + - + [% FOREACH library IN libraries %] +
  4. +
  5. + + + Required

    + Note: If you installed sample patron categories please select the "Staff" option in the patron categories dropdown box. +
  6. +
- -[% ELSIF op == 'add_validate' %] - -
- -

Koha administrator patron

-
-

Success: administrator patron created!

-

To create another patron, go to Patrons -> New Patron.
- More -> Set Permissions in a user page to gain superlibrarian permissions. -

- Next up: - -
-[% ELSE %] - -

Create koha administrator patron

+
    +

    Koha administrator patron permissions

    +
  1. + +
  2. +
+
    +

    OPAC/Staff Login

    +
  1. + + + Required +
  2. +
  3. + + + Required +
  4. +
  5. + + + Required +
  6. +

- Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions. + To create another patron, go to Patrons -> New Patron.
+ More -> Set Permissions in a user page to gain superlibrarian permissions.

-
-
- - - Library management -
    -

    Patron identity

    -
  1. - - - Required -
  2. -
  3. - - - Required -
  4. -
- -
    -
  1. - - [% IF patrons && patrons > 1 %] - - [% ELSE %] - - [% END %] - Required -
  2. -
  3. - - - - - Required -
  4. -
  5. - - - Required

    - Note: If you installed sample patron categories please select the "Staff" option in the patron categories dropdown box. -
  6. -
- -
    -

    Koha administrator patron permissions

    - -
  1. - - -
  2. -
-
    -

    OPAC/Staff Login

    -
  1. - - - - Required -
  2. -
  3. - - - Required -
  4. -
  5. - - - Required -
  6. -
-

- -
-[% END %] +
+
+ + 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 6176fb4..4a32f9d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt @@ -1,67 +1,39 @@ [% INCLUDE 'doc-head-open.inc' %] -[% IF ( finish ) %][% END%] [% INCLUDE 'installer-doc-head-close.inc' %] - - Create item type +[% INCLUDE 'validator-strings.inc' %] +[% INCLUDE 'installer-strings.inc' %] + -
-

Koha Welcome to Koha

-
-[% IF (itemtypes && itemtypes.count >1) %] +[% INCLUDE 'onboarding_messages.inc' %] - + +

Create a new Item type

+

Item types are used to group related items. Examples of item types are books, cds, and DVDs.

When adding to your institutions catalogue you will create an item of a particular item type.

Importantly item types are what you apply circulation rules to. Circulation rules govern how your institution will lend its items, for example a circulation rule applied to the DVD item type may enforce a payment of $1.00 for borrowing any DVD.

+
+
+ + +
    +
  1. + + + Required +
  2. -[% ELSIF op == "add_validate" %] - [% IF message != "error_on_insert" %] - - -

    New Item type

    -
    -

    Success: New item type created!

    -

    To create another item type later and for more settings
    - go to:
    - More -> Administration -> Item types
    -

    - Next up: - - - [% ELSE %] -
    - -

    Failed

    -
    -

    Item type was not successfully created.
    - Please try again or contact your system administrator. -

    -
    -
    - - [% END %] -[% ELSE %] - -

    Create a new Item type

    -

    Item types are used to group related items. Examples of item types are books, cds, and DVDs.

    When adding to your institutions catalogue you will create an item of a particular item type.

    Importantly item types are what you apply circulation rules to. Circulation rules govern how your institution will lend its items, for example a circulation rule applied to the DVD item type may enforce a payment of $1.00 for borrowing any DVD.

    -
    -
    - - -
      -
    1. - - - Required -
    2. +
    3. + + + Required +
    4. +
    +
    +

    To create another item type later and for more settings
    + go to:
    + More -> Administration -> Item types
    +

    -
  3. - - - Required -
  4. -
-
- -
- -[% END %] + + + 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 81ba89c..8e3519b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt @@ -1,127 +1,116 @@ [% INCLUDE 'doc-head-open.inc' %] Create Circulation rule -[% IF ( finish ) %][% END %] [% INCLUDE 'installer-doc-head-close.inc' %] +[% INCLUDE 'validator-strings.inc' %] +[% INCLUDE 'installer-strings.inc' %] + + -
-

Koha Welcome to Koha

-
+ -[% IF (finish) %] +[% INCLUDE 'onboarding_messages.inc' %] + +[% IF all_done %]

Congratulations you have finished and ready to use Koha

Start using Koha - -[% END %] - - -[% IF op == "add_validate" %] - -
- -

New circulation rule

-
-

Success: circulation rule created!

-

To create circulation rule, go to
- More -> Administration -> Circulation and Fine Rules -

- Next up: - -
[% ELSE %] - -

Create a new circulation rule

-
-
- - -
    -
  1. - - - Required -
  2. -
  3. - - - Required -
  4. +

    Create a new circulation rule

    + +
    + + +
      +
    1. + + + Required +
    2. +
    3. + + + Required +
    4. + +
    5. + + + Required +
    6. +
    7. + + + Required +
    8. -
    9. - - - Required -
    10. -
    11. - - - Required -
    12. +
    13. + + + Required +
    14. +
    15. + + - Required -
    16. -
    17. - - +
    18. +
    19. + + + Required +
    20. - [% SWITCH units %] - [% CASE 'days' %] - - - [% CASE 'hours' %] - - - [% END %] - - -
    21. - - - Required -
    22. +
    23. + + + Required +
    24. -
    25. - - - Required -
    26. +
    27. + + +
    28. +
    +

    To create circulation rule, go to
    + More -> Administration -> Circulation and Fine Rules +

    -
  5. - - -
  6. -
-

- -
+
+ + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/onboarding.js b/koha-tmpl/intranet-tmpl/prog/js/onboarding.js new file mode 100644 index 0000000..9b1d13d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/onboarding.js @@ -0,0 +1,150 @@ +function _(s) { return s; } // dummy function for gettext + +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_LETTERS_ONLY +); + +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_LETTERS_ONLY +); + +jQuery.validator.addMethod( "enrollment_period", function(){ + enrolmentperiod = $("#enrolmentperiod").val(); + enrolmentperioddate = $("#enrolmentperioddate").val(); + if (( $("#enrolmentperiod").val() === "" && $("#enrolmentperioddate").val() === "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) { + return false; + } else { + return true; + } + }, MSG_ONLY_ONE_ENROLLMENTPERIOD +); + +jQuery.validator.addMethod( "password_match", function(value,element){ + var MSG_PASSWORD_MISMATCH = ( MSG_PASSWORD_MISMATCH ); + var password = document.getElementById('password').value; + var confirmpassword = document.getElementById('password2').value; + + if ( password != confirmpassword ){ + return false; + } + else{ + return true; + } + }, MSG_PASSWORD_MISMATCH +); + +jQuery.validator.addMethod( "cardnumber_check", function(value,element){ + var patt =/[A-Za-z1-9 ]+$/g; + if (patt.test(element.value)){ + return true; + } else { + return false; + } + }, MSG_LETTERS_NUMBERS_ONLY +); + +function toUC(f) { + var x=f.value.toUpperCase(); + f.value=x; + return true; +} + +$(document).ready(function() { + if ($("#branches option:selected").length < 1) { + $("#branches option:first").attr("selected", "selected"); + } + $("#categorycode").on("blur",function(){ + toUC(this); + }); + + $("#enrolmentperioddate").datepicker({ + minDate: 1 + }); // Require that "until date" be in the future + + $("#category_form").validate({ + rules: { + categorycode: { + required: true, + category_code_check: true + }, + description: { + required: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 + } + } + }); + + $("#createpatron").validate({ + rules: { + surname: { + required: true + }, + firstname: { + required: true + }, + cardnumber: { + required: true + }, + password: { + password_match: true + } + }, + messages: { + password: { + required: MSG_PASSWORD_MISMATCH + }, + } + + }); + + $("#createitemform").validate(); + $("#createcirculationrule").validate(); +}); -- 2.1.4