@@ -, +, @@ comments in the onboarding.pl script --- installer/onboarding.pl | 77 ++++++++-------------- .../prog/en/modules/onboarding/onboardingstep1.tt | 2 +- .../prog/en/modules/onboarding/onboardingstep2.tt | 4 +- 3 files changed, 30 insertions(+), 53 deletions(-) --- a/installer/onboarding.pl +++ a/installer/onboarding.pl @@ -10,8 +10,6 @@ use CGI qw ( -utf8 ); use List::MoreUtils qw/uniq/; use Digest::MD5 qw(md5_base64); use Encode qw( encode ); - -#Internal modules use C4::Koha; use C4::Auth; use C4::Context; @@ -46,7 +44,7 @@ my $input = new CGI; my $query = new CGI; my $step = $query->param('step'); -#Getting the appropriate template to display to the user--> +#Getting the appropriate template to display to the user my ( $template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user( { template_name => "/onboarding/onboardingstep" . ( $step ? $step : 0 ) . ".tt", @@ -87,8 +85,9 @@ if ( $op && $op eq 'finish' ) { #If the value of $op equals 'finish' then redire #Store the value of the template input name='start' in the variable $start so we can check if the user has pressed this button and started the onboarding tool process my $start = $query->param('start'); -$template->param('start'=>$start); #Hand the start variable back to the template -if ( $start && $start eq 'Start setting up my Koha' ){ +$template->param('start'=>$start); + +if ( $start && $start eq 'Start setting up my Koha' ){ my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); $template->param(libraries => $libraries, group_types => [ @@ -101,20 +100,6 @@ 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 store them in the newly declared variable $categories - my $categories = Koha::Patron::Categories->search(); - $template->param( - categories => $categories, - ); #Hand the variable categories back to the template - -}elsif ( $start && $start eq 'Add an item type' ){ - my $itemtypes = Koha::ItemTypes->search(); - $template->param( - itemtypes => $itemtypes, - );#Hand the variable itemtypes back to the template - #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 @@ -157,6 +142,12 @@ if ( $start && $start eq 'Start setting up my Koha' ){ 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'); @@ -195,7 +186,7 @@ if ( $start && $start eq 'Start setting up my Koha' ){ dateonly => 1, } ); - } + } #Adds a new patron category to the database $category = Koha::Patron::Category->new({ @@ -275,20 +266,18 @@ if ( $start && $start eq 'Start setting up my Koha' ){ :() } -# unless(Check_Userid($userid, $borrowernumber)){ -# push @errors, "ERROR_login_exist"; -# } 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); + $nok = $nok || scalar(@errors); - if($nok){ + if($nok){ - foreach my $error (@errors){ - if ($error eq 'ERROR_password_mismatch'){ - $template->param(errorpasswordmismatch => 1); + foreach my $error (@errors){ + if ($error eq 'ERROR_password_mismatch'){ + $template->param(errorpasswordmismatch => 1); } if ($error eq 'ERROR_login_exist'){ $template->param(errorloginexists =>1); @@ -368,16 +357,16 @@ if ( $start && $start eq 'Start setting up my Koha' ){ $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); $sth->execute($module_flags, $borrowernumber); - #Error handling checking if the patron was created successfully - if(!$borrowernumber){ - push @messages, {type=> 'error', code => 'error_on_insert'}; - }else{ - push @messages, {type=> 'message', code => 'success_on_insert'}; - } - } + #Error handling checking if the patron was created successfully + if(!$borrowernumber){ + push @messages, {type=> 'error', code => 'error_on_insert'}; + }else{ + push @messages, {type=> 'message', code => 'success_on_insert'}; + } + } } } -}elsif ( $step && $step == 4){ + }elsif ( $step && $step == 4){ my $createitemtype = $input->param('createitemtype'); $template->param('createitemtype'=> $createitemtype ); @@ -554,8 +543,7 @@ if ( $start && $start eq 'Start setting up my Koha' ){ } else { $sth_insert->execute($branch, $onshelfholds); } - } -#End new code + } my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br }); if($issuingrule){ @@ -566,17 +554,6 @@ if ( $start && $start eq 'Start setting up my Koha' ){ Koha::IssuingRule->new()->set($params)->store(); } } - - my @messages; - - my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br }); - if($issuingrule){ - $issuingrule->set($params)->store(); - push @messages, {type=> 'error', code => 'error_on_insert'};#Stops crash of the onboarding tool if someone makes a circulation rule with the same item type, library and patron categroy as an exisiting circulation rule. - }else{ - Koha::IssuingRule->new()->set($params)->store(); - } - } } output_html_with_http_headers $input, $cookie, $template->output; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt @@ -36,7 +36,7 @@
-

Welcome to Koha

+

Welcome to Koha test if in correct repo

Koha

[% IF libraries.count > 0 %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt @@ -284,7 +284,7 @@ $(document).ready(function(){ [% ELSE %] -

Create a new Patron Category

+

Create a new Patron Category testing rwq

@@ -292,7 +292,7 @@ $(document).ready(function(){
  1. - + Required
  2. --