@@ -, +, @@ step 3 is showing bulletpoints for default data values which stops the user being able to unselect data neccisary to use Koha. --- .../en/{optional => default}/patron_categories.sql | 0 .../en/{optional => default}/patron_categories.txt | 0 installer/onboarding.pl | 142 ++++++++++++++ .../prog/en/modules/installer/step3.tt | 102 +++++----- .../en/modules/onboarding/.onboardingstep1.tt.swp | Bin 0 -> 36864 bytes .../en/modules/onboarding/.onboardingstep2.tt.swp | Bin 0 -> 20480 bytes .../prog/en/modules/onboarding/onboardingstep1.tt | 109 +++++++++++ .../prog/en/modules/onboarding/onboardingstep2.tt | 213 +++++++++++++++++++++ 8 files changed, 518 insertions(+), 48 deletions(-) rename installer/data/mysql/en/{optional => default}/patron_categories.sql (100%) rename installer/data/mysql/en/{optional => default}/patron_categories.txt (100%) create mode 100755 installer/onboarding.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/.onboardingstep1.tt.swp create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/.onboardingstep2.tt.swp create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt --- a/installer/onboarding.pl +++ a/installer/onboarding.pl @@ -0,0 +1,142 @@ +#!/usr/bin/perl +#Recommended pragmas +use strict; +use warnings; +use diagnostics; + + +use C4::Koha; +#Pragmas for creating library +use Modern::Perl; +use CGI qw (-utf8); +use C4::Auth; +use C4::Context; +use C4::Output; +use Koha::Patrons; +use Koha::Items; +use Koha::Libraries; +use Koha::LibraryCategories; + + +use POSIX; +use C4::Templates; +use C4::Languages qw(getAllLanguages getTranslatedLanguages); +use C4::Installer; +use Koha; +use installer::install.pl; + +#Setting variables from install.pl origin +my $query = new CGI; +my $step = $query->param('step'); + +my ( $template, $loggedinuser, $cookie) = get_template_and_user( + { + template_name => "/onboarding/onboardingstep" . ( $step ? $step : 1 ) . ".tt", + query => $query, + 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" ); + +$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'} +); + + + + +#Performing each step of the onboarding tool +if ( $step && $step == 1 ) { +#This is the Initial step of the onboarding tool to create a library + +#store inputted parameters in variables + my $branchcode = $input->param('branchcode'); + my $categorycode = $input->param('categorycode'); + my $op = $input->param('op') || 'list'; + my @messages; + my $library; + +#Find branchcode if it exists + if ( $op eq 'add_form' ) { + if ($branchcode) { + $library = Koha::Libraries->find($branchcode); + } + + $template->param( + library => $library, + categories => [ Koha::LibraryCategories->search( {}, { order_by => [ 'categorytype', 'categoryname' ] } ) ], + $library ? ( selected_categorycodes => [ map { $_->categorycode } $library->get_categories ] ) : (), + ); + } elsif ( $op eq 'add_validate' ) { + my @fields = qw( + branchname + ); + + my $is_a_modif = $input->param('is_a_modif'); + + my @categories; + for my $category ( Koha::LibraryCategories->search ) { + push @categories, $category + if $input->param( "selected_categorycode_" . $category->categorycode ); + } + if ($is_a_modif) { + my $library = Koha::Libraries->find($branchcode); + for my $field (@fields) { + $library->$field( scalar $input->param($field) ); + } + $library->update_categories( \@categories ); + + eval { $library->store; }; + + if ($@) { + push @messages, { type => 'alert', code => 'error_on_update' }; + } else { + push @messages, { type => 'message', code => 'success_on_update' }; + } + } else { + $branchcode =~ s|\s||g; + my $library = Koha::Library->new( + { branchcode => $branchcode, + ( map { $_ => scalar $input->param($_) || undef } @fields ) + } + ); + eval { $library->store; }; + $library->add_to_categories( \@categories ); + if ($@) { + push @messages, { type => 'alert', code => 'error_on_insert' }; + } else { + push @messages, { type => 'message', code => 'success_on_insert' }; + } + } + $op = 'list'; + } + + if ($op eq 'list'){ + print redirect(-url=>'koha/cgi-bin/koha/onboarding/onboarding.cgi?step=2'); + } + +} + + + + + + + + + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt @@ -1,5 +1,5 @@ [% INCLUDE 'doc-head-open.inc' %]Koha › Web installer › Step 3 -[% IF ( finish ) %][% END %] +[% IF ( finish ) %][% END %] [% INCLUDE 'installer-doc-head-close.inc' %]

Koha Koha web installer › Step 3

@@ -64,7 +64,7 @@ [% END %] [% IF ( finish ) %]

Congratulations, installation complete

-

If this page does not redirect in 5 seconds, click here.

+

If this page does not redirect in 5 seconds, click here.

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

Select your MARC flavor

@@ -75,10 +75,10 @@

[% FOREACH flavourloo IN flavourloop %]

- [% IF ( flavourloo.checked ) %] - [% flavourloo.label %]
+ [% IF ( flavourloo.label == "Unimarc") %] + [% flavourloo.label %]
[% ELSE %] - [% flavourloo.label %]
+ [% flavourloo.label %]
[% END %]
[% END %] @@ -100,49 +100,49 @@ [% 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)

+

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 %]
- [% IF (frameworksloo.label == "Default" ) %] - +
+

[% frameworksloo.label %]

+ [% FOREACH framework IN frameworksloo.frameworks %] + + + + [% ELSE %] - - [% END %] - - - [% ELSE %] - - [% END %] - + + [% END %] +
+ [% IF (frameworksloo.label == "Default" ) %] + + [% ELSE %] + + [% END %] + + [% IF (frameworksloo.label == "Default" ) %] +
    + +
+
- [% IF (frameworksloo.label == "Default" ) %] -
    - -
-
- -
+ +
- [% END %] -
- [% END %] + [% END %] + + [% END %]

Other data

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

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

- [% END %] + [% 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 %]

@@ -151,19 +151,24 @@
[% IF (levelloo.label == "Default" ) %] - +<<<<<<< HEAD + +======= +
    +
+>>>>>>> 9e47b85... Removed test text [% ELSE %] - + [% END %]
[% IF (levelloo.label == "Default") %] -
    +
      -
    +
@@ -201,7 +206,8 @@
-
+ +

[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt @@ -0,0 +1,109 @@ + + + +[% INCLUDE 'doc-head-open.inc' %] + + +Welcome › to › Koha + + + + + + +[% IF ( finish ) %][% END %] +[% INCLUDE 'installer-doc-head-close.inc' %] +
+

Welcome to Koha

+

Koha

+
+ + Set up my koha +
+ + +[% IF (setupmyKoha) %] +

New Library

+ +
+ + + +
    +
  1. + + + Required +
  2. +
  3. + + + Required +
  4. +
+
+
+ +
+ +[% END %] + + +[% IF (createlibrary) %] + [% IF (library) %] + +
+ + +

New Library

+ +
+

Success: Library created!


+

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

+ Next up: + +
+ [% ELSE %] +
+

Library was not successfully created

+
+ [% END %] + [% END %] + + + + + + + + + + + + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt @@ -0,0 +1,213 @@ + +[% USE Koha %] +[% USE KohaDates %] +[% USE Price %] +[% INCLUDE 'doc-head-open.inc' %] +[% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'calendar.inc' %] +[% INCLUDE 'datatables.inc' %] + + + + Add a patron category + + + + + + + + + [% IF (addpatroncategory) %] + ........ +
+
+
+
+ [% FOR m IN messages %] +
+ [% SWITCH m.code %] + [% CASE 'error_on_insert' %] + An error occurred when inserting this patron category. The patron category might already exist. + [% CASE 'success_on_insert' %] + Patron category inserted successfully. + [% CASE 'already_exists' %] + This patron category already exists. + [% CASE %] + [% m.code %] + [% END %] +
+ [% END %] + +
+ + + + +

New Patron Category

+
+
+
    +
  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. + +
  11. + Enrollment period: +
    + Choose one +
      +
    1. + + months +
    2. +
    3. + + +
    4. +
    +
    +
  12. + +
    + +
    + + [% END %] + + [% IF (addpatroncategory) %] + [% IF (categorycode) %] +
    ... + +

    New patron category

    +
    . +

    Success: Patron category created!

    +

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

    +
    + Next up: + + + [% ELSE %] +

    Patron category was not successfully created

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