@@ -, +, @@ --- C4/Members.pm | 2 +- installer/onboarding.pl | 96 +++++++-------- .../intranet-tmpl/prog/en/includes/calendar.inc | 2 +- .../prog/en/includes/installer-doc-head-close.inc | 15 +++ .../prog/en/modules/onboarding/onboardingstep1.tt | 4 +- .../prog/en/modules/onboarding/onboardingstep2.tt | 134 +++++++++++++-------- .../prog/en/modules/onboarding/onboardingstep3.tt | 21 +--- .../prog/en/modules/onboarding/onboardingstep4.tt | 6 +- .../prog/en/modules/onboarding/onboardingstep5.tt | 12 +- 9 files changed, 159 insertions(+), 133 deletions(-) --- a/C4/Members.pm +++ a/C4/Members.pm @@ -498,7 +498,7 @@ sub AddMember { } my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} ); - $data{'privacy'} = + $data{'privacy'} = $patron_category->default_privacy() eq 'default' ? 1 : $patron_category->default_privacy() eq 'never' ? 2 : $patron_category->default_privacy() eq 'forever' ? 0 --- a/installer/onboarding.pl +++ a/installer/onboarding.pl @@ -184,7 +184,6 @@ if ( $start && $start eq 'Start setting up my Koha' ){ debug => 1, } ); - #Once the user submits the page, this code validates the input and adds it #to the database as a new patron category @@ -233,7 +232,6 @@ if ( $start && $start eq 'Start setting up my Koha' ){ #Create a patron }elsif ( $step && $step == 3 ){ - my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); $template->param(libraries => $libraries, group_types => [ @@ -252,11 +250,11 @@ if ( $start && $start eq 'Start setting up my Koha' ){ categories => $categories, ); - my $input = new CGI; my $op = $input->param('op') // 'list'; - my @messages; + my @messages; + my @errors; my ($template, $loggedinuser, $cookie)= get_template_and_user({ template_name => "/onboarding/onboardingstep3.tt", @@ -267,16 +265,8 @@ if ( $start && $start eq 'Start setting up my Koha' ){ debug => 1, }); - if($op eq 'add_form'){ - my $member; - $template->param( - member => $member, - ); - } - - elsif($op eq 'add_validate'){ - - my %newdata; + if($op eq 'add_validate'){ + my %newdata; #Store the template form values in the newdata hash $newdata{borrowernumber} = $input->param('borrowernumber'); @@ -289,14 +279,26 @@ if ( $start && $start eq 'Start setting up my Koha' ){ $newdata{password} = $input->param('password'); $newdata{password2} = $input->param('password2'); $newdata{dateexpiry} = '12/10/2016'; + $newdata{privacy} = "default"; + + if(my $error_code = checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ + push @errors, $error_code == 1 + ? 'ERROR_cardnumber_already_exists' + :$error_code == 2 + ? 'ERROR_cardnumber_length' + :() + } + + #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 fillit with the borrowernumber of the borrower that has just been created my %member2; $member2{'borrowernumber'}=$borrowernumber; my $flag = $input->param('flag'); - if ($input->param('newflags')) { my $dbh=C4::Context->dbh(); my @perms = $input->multi_param('flag'); @@ -312,27 +314,28 @@ if ( $start && $start eq 'Start setting up my Koha' ){ } - # construct flags - my $module_flags = 0; - my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); - $sth->execute(); - while (my ($bit, $flag) = $sth->fetchrow_array) { - if (exists $all_module_perms{$flag}) { - $module_flags += 2**$bit; - } - } + # construct flags + my $module_flags = 0; + my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); + $sth->execute(); + while (my ($bit, $flag) = $sth->fetchrow_array) { + if (exists $all_module_perms{$flag}) { + $module_flags += 2**$bit; + } + } - $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); - $sth->execute($module_flags, $borrowernumber); + $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){ my $createitemtype = $input->param('createitemtype'); $template->param('createitemtype'=> $createitemtype ); @@ -360,14 +363,14 @@ if ( $start && $start eq 'Start setting up my Koha' ){ my $description = $input->param('description'); #store the input from the form - only 2 fields - my $itemtype= Koha::ItemType->new( + my $thisitemtype= Koha::ItemType->new( { itemtype => $itemtype_code, description => $description, } ); - eval{ $itemtype->store; }; + eval{ $thisitemtype->store; }; #Error messages - if($itemtype){ + if($thisitemtype){ $message = 'success_on_insert'; }else{ $message = 'error_on_insert'; @@ -375,8 +378,10 @@ if ( $start && $start eq 'Start setting up my Koha' ){ $template->param('message' => $message); } - }elsif ( $step && $step == 5){ + my $test="a"; + warn $test; + #Fetching all the existing categories to display in a drop down box my $categories; $categories= Koha::Patron::Categories->search(); @@ -403,14 +408,7 @@ if ( $start && $start eq 'Start setting up my Koha' ){ my $type = $input->param('type'); my $branch = $input->param('branch'); - - - if($op eq 'add_form'){ - - - - } - elsif($op eq 'add_validate'){ + if($op eq 'add_validate'){ my $bor = $input->param('categorycode'); my $itemtype = $input->param('itemtype'); my $maxissueqty = $input->param('maxissueqty'); @@ -435,14 +433,10 @@ if ( $start && $start eq 'Start setting up my Koha' ){ $issuingrule->set($params)->store(); }else{ Koha::IssuingRule->new()->set($params)->store(); - } + } } + } - my $createcirculationrule = $query->param('createcirculationrule'); - $template->param('createcirculationrule'=>$createcirculationrule); -} - -} output_html_with_http_headers $input, $cookie, $template->output; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -6,7 +6,7 @@ var debug = "[% debug %]"; var dformat = "[% dateformat %]"; var sentmsg = 0; if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");} -var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %s)."); +var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s).")); function is_valid_date(date) { // An empty string is considered as a valid date for convenient reasons. --- a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc @@ -1,5 +1,9 @@ + + + + + + + + + + + + + + + + - - @@ -42,7 +103,6 @@ [% ELSIF op == "add_validate" %] [% IF message != "error_on_insert" %]
- Message is [%message%]

New patron category

@@ -67,21 +127,21 @@ [% ELSE %] -

Create a new Patron Category

- -
+

Create a new Patron Category

+ +
  1. - + Required
  2. - + Required
  3. @@ -101,41 +161,11 @@
  4. Required
  5. @@ -174,11 +204,11 @@
    1. - months + months
    2. - +
@@ -187,9 +217,7 @@ [% END %] - - - +[% INCLUDE 'intranet-bottom.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt @@ -54,12 +54,12 @@
  • - + Required
  • - + Required
  • @@ -68,7 +68,7 @@
    1. - + Required
    2. @@ -87,7 +87,7 @@ Required @@ -124,15 +124,4 @@

    -[% END %] - - - - - - - - - - - +[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt @@ -67,13 +67,13 @@
    1. - - + + Required
    2. - + Required
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt @@ -57,9 +57,9 @@
  • Required @@ -77,13 +77,13 @@
  • - + Required
  • - + Required
  • @@ -109,13 +109,13 @@
  • - + Required
  • - + Required
  • --