@@ -, +, @@ --- installer/onboarding.pl | 208 ++++++++--------- .../prog/en/modules/installer/Backupstep3.tt | 257 --------------------- .../prog/en/modules/installer/step3.tt | 189 +++++++-------- .../prog/en/modules/onboarding/onboardingstep0.tt | 18 -- .../prog/en/modules/onboarding/onboardingstep1.tt | 57 ++--- .../prog/en/modules/onboarding/onboardingstep2.tt | 42 ++-- .../prog/en/modules/onboarding/onboardingstep3.tt | 87 +++++-- .../prog/en/modules/onboarding/onboardingstep4.tt | 100 ++++---- .../prog/en/modules/onboarding/onboardingstep5.tt | 52 +++-- 9 files changed, 383 insertions(+), 627 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/installer/Backupstep3.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt --- a/installer/onboarding.pl +++ a/installer/onboarding.pl @@ -63,7 +63,7 @@ my ( $template, $loggedinuser, $cookie ) = C4::InstallAuth::get_template_and_user( { template_name => "/onboarding/onboardingstep" - . ( $step ? $step : 0 ) . ".tt", + . ( $step ? $step : 1 ) . ".tt", query => $input, type => "intranet", authnotrequired => 0, @@ -93,60 +93,46 @@ my $dbh = DBI->connect( #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 ); + 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; } -#Store the value of the template input name='start' in the variable $start so we can check if the user has pressed this button and started the onboarding tool process -my $start = $input->param('start'); -$template->param( 'start' => $start ); +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 ( $start && $start eq 'Start setting up my Koha' ) { - 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' } - ) - ], - }, - ] - ); -} -elsif ( $start && $start eq 'Minimal patron category setup' ) { #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, ); + $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 ( $start && $start eq 'Minimal item type setup' ) { - my $itemtypes = Koha::ItemTypes->search(); - $template->param( itemtypes => $itemtypes, ); -} -elsif ( $step && $step == 1 ) { - my $createlibrary = $input->param('createlibrary') - ; #Store the inputted library branch code and name in $createlibrary variable - $template->param( 'createlibrary' => $createlibrary ) - ; # Hand the library values back to the template in the createlibrary variable + $template->param( 'itemtypes' => $itemtypes, ); +if ( $step && $step == 1 ) { #store inputted parameters in variables my $branchcode = $input->param('branchcode'); $branchcode = uc($branchcode); @@ -179,88 +165,94 @@ elsif ( $step && $step == 1 ) { else { $message = 'error_on_insert'; } + warn $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 = $input->param('createcat') - ; #Store the inputted category code and name in $createcat - $template->param( 'createcat' => $createcat ); + if ($op eq "add_validate_category"){ + #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 ); - #Initialising values - my $searchfield = $input->param('description') // q||; - my $categorycode = $input->param('categorycode'); - my $op = $input->param('op') // 'list'; - my $message; - my $category; - $template->param( 'categorycode' => $categorycode ); + my ( $template, $loggedinuser, $cookie ) = + C4::InstallAuth::get_template_and_user( + { + template_name => "/onboarding/onboardingstep2.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => + { parameters => 'parameters_remaining_permissions' }, + debug => 1, + } + ); - my ( $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( + { + dt => dt_from_string($enrolmentperioddate), + dateformat => 'iso', + dateonly => 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( + #Adds a new patron category to the database + $category = Koha::Patron::Category->new( { - dt => dt_from_string($enrolmentperioddate), - dateformat => 'iso', - dateonly => 1, + categorycode => $categorycode, + description => $description, + overduenoticerequired => $overduenoticerequired, + category_type => $category_type, + default_privacy => $default_privacy, + enrolmentperiod => $enrolmentperiod, + enrolmentperioddate => $enrolmentperioddate, } ); - } - #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; }; - 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'); + + #Find all patron records in the database and hand them to the template + my %currentpatrons = Koha::Patrons->search(); + my $currentpatrons = values %currentpatrons; + warn $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'] }, ); @@ -288,11 +280,12 @@ elsif ( $step && $step == 3 ) { #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, ); + $template->param( '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"); + warn $exisiting_cardnumber; my $new_cardnumber = $exisiting_cardnumber + 1; warn $new_cardnumber; $template->param( "newcardnumber" => $new_cardnumber ); @@ -446,9 +439,6 @@ elsif ( $step && $step == 3 ) { } } elsif ( $step && $step == 4 ) { - my $createitemtype = $input->param('createitemtype'); - $template->param( 'createitemtype' => $createitemtype ); - my ( $template, $borrowernumber, $cookie ) = C4::InstallAuth::get_template_and_user( { @@ -460,11 +450,11 @@ elsif ( $step && $step == 4 ) { { parameters => 'parameters_remaining_permissions' }, debug => 1, } - ); - - if ( $op eq 'add_validate' ) { + ); + if ($op eq "add_validate"){ my $description = $input->param('description'); my $itemtype_code = $input->param('itemtype'); + warn $description; $itemtype_code = uc($itemtype_code); #Create a new itemtype object using the user inputted itemtype and description @@ -672,8 +662,6 @@ elsif ( $step && $step == 5 ) { } } - #End new code - my $issuingrule = Koha::IssuingRules->find( { categorycode => $bor, itemtype => $itemtype, branchcode => $br } ); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/Backupstep3.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/Backupstep3.tt @@ -1,257 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %]
If this page does not redirect in 5 seconds, click here.
-[% END %] -[% IF ( choosemarc ) %] -Installation complete.
-
Click on 'Finish' to complete and load the Koha Staff Interface. -
- - -[% END %] - - -[% IF ( importdatastructure ) %] - [% IF ( error ) %] -The following error occurred while importing the database structure:
-[% error %]
-Please contact your system administrator
- [% ELSE %] -Now we're ready to create the database tables and fill them with some default data.
- -[% END %] - - -[% IF ( default ) %] - [% IF ( upgrading ) %] -- We are upgrading from Koha [% dbversion %] to [% kohaversion %], you must update your database -
- [% ELSE %] -We are ready to do some basic configuration. Please install some basic configuration settings to continue the installation:
-
-
-
-
Update report :
-Update errors :
-Everything went OK, update done.
- [% END %] -Continue to log in to Koha -