Bugzilla – Attachment 86496 Details for
Bug 22489
Onboarding tool fails due to inserting maxissueqty into IssuingRule
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22489: Fixed issue with onboarding tool failing at step 5
Bug-22489-Fixed-issue-with-onboarding-tool-failing.patch (text/plain), 6.85 KB, created by
Hayley Pelham
on 2019-03-12 03:09:55 UTC
(
hide
)
Description:
Bug 22489: Fixed issue with onboarding tool failing at step 5
Filename:
MIME Type:
Creator:
Hayley Pelham
Created:
2019-03-12 03:09:55 UTC
Size:
6.85 KB
patch
obsolete
>From d3f0b0bcb959863c38ea81fe0dbf87b4a546c41c Mon Sep 17 00:00:00 2001 >From: Hayley Mapley <hayleymapley@catalyst.net.nz> >Date: Tue, 12 Mar 2019 02:23:38 +0000 >Subject: [PATCH] Bug 22489: Fixed issue with onboarding tool failing at step 5 > >When going through the onboarding process, the tool fails on submit of >step 5, due to changes made in the database structure and rule >definitions. > >This patch fixes this, adding code that creates a circulation rule where an issuing rule is also >created in onboarding.pl. It removes maxissueqty from being sent with params to >make an issuing rule, and adds it instead to the params to make a >circulation rule, to reflect the changes that have been made in the database. > >Test plan: >1) Drop and recreate your database >2) Reload the staff client and follow the installer and onboarding >process >3) Confirm that the process finishes without errors >--- > admin/smart-rules.pl | 6 +++++ > installer/onboarding.pl | 30 +++++++++++++++++----- > .../prog/en/modules/onboarding/onboardingstep5.tt | 11 ++++---- > 3 files changed, 35 insertions(+), 12 deletions(-) > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index e9c1bf121d..9200c04948 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -222,6 +222,10 @@ elsif ($op eq 'add') { > Koha::IssuingRule->new()->set($params)->store(); > } > >+ warn $bor; >+ warn $itemtype; >+ warn $br; >+ > Koha::CirculationRules->set_rules( > { > categorycode => $bor, >@@ -298,6 +302,8 @@ elsif ($op eq "set-branch-defaults") { > $sth_insert->execute($branch, $holdallowed, $hold_fulfillment_policy, $returnbranch); > } > >+ warn $branch; >+ warn $categorycode; > Koha::CirculationRules->set_rules( > { > categorycode => undef, >diff --git a/installer/onboarding.pl b/installer/onboarding.pl >index 1acc420c43..ae729fc628 100755 >--- a/installer/onboarding.pl >+++ b/installer/onboarding.pl >@@ -31,6 +31,8 @@ use Koha::Patrons; > use Koha::Patron::Categories; > use Koha::ItemTypes; > use Koha::IssuingRules; >+use Koha::CirculationRules; >+use Switch; > > #Setting variables > my $input = new CGI; >@@ -240,28 +242,44 @@ if ( $step == 5 ) { > my $maxissueqty = $input->param('maxissueqty'); > my $issuelength = $input->param('issuelength'); > my $lengthunit = $input->param('lengthunit'); >- my $renewalsallowed = $input->param('renewalsallowed'); >+ my $renewalsallowed = $input->param('renewalsallowed'); > my $renewalperiod = $input->param('renewalperiod'); > my $onshelfholds = $input->param('onshelfholds') || 0; > $maxissueqty =~ s/\s//g; > $maxissueqty = undef if $maxissueqty !~ /^\d+/; > $issuelength = $issuelength eq q{} ? undef : $issuelength; > >- my $params = { >+ my $issuingruleparams = { > branchcode => $branchcode, > categorycode => $categorycode, > itemtype => $itemtype, >- maxissueqty => $maxissueqty, > renewalsallowed => $renewalsallowed, > renewalperiod => $renewalperiod, > issuelength => $issuelength, > lengthunit => $lengthunit, > onshelfholds => $onshelfholds, > }; >+ $branchcode = $branchcode if $branchcode ne '*'; >+ $branchcode = undef if $branchcode eq '*'; >+ $categorycode = $categorycode if $categorycode ne '*'; >+ $categorycode = undef if $categorycode eq '*'; >+ $itemtype = $itemtype if $itemtype ne '*'; >+ $itemtype = undef if $itemtype eq '*'; >+ >+ my $circulationruleparams = { >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ itemtype => $itemtype, >+ rule_name => 'patron_maxissueqty', >+ rule_value => $maxissueqty, >+ }; > >- my $issuingrule = Koha::IssuingRule->new($params); >+ my $issuingrule = Koha::IssuingRule->new($issuingruleparams); > eval { $issuingrule->store; }; > >+ my $circulationrule = Koha::CirculationRule->new($circulationruleparams); >+ eval { $circulationrule->store; }; >+ > unless ($@) { > push @messages, { code => 'success_on_insert_circ_rule' }; > } >@@ -269,8 +287,8 @@ if ( $step == 5 ) { > push @messages, { code => 'error_on_insert_circ_rule' }; > } > } >- >- $step++ if Koha::IssuingRules->count; >+ warn Koha::CirculationRules->count; >+ $step++ if (Koha::IssuingRules->count && Koha::CirculationRules->count); > } > > my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); >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 d6eb24e7fc..4e8997507c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt >@@ -71,12 +71,6 @@ > <span class="required"> Required</span> > </li> > <li> >- <label for="maxissueqty" class="required">Current checkouts allowed: </label> >- <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> > <label for="issuelength" class="required">Loan period: </label> > <input type="number" min="0" name="issuelength" id="issuelength" size="10" value="14" class="required" required="required" /> > <span class="required">Required</span> >@@ -101,6 +95,11 @@ > </select> > </li> > <li> >+ <label for="maxissueqty" class="required">Current checkouts allowed: </label> >+ <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" /> >+ <span class="required">Required</span> >+ </li> >+ <li> > <label for="renewalsallowed" class="required">Renewals allowed: </label> > <input type="number" min="0" name="renewalsallowed" id="renewalsallowed" size="10" max="10" value="10" class="required" required="required" /> > <span class="required">Required</span> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22489
:
86496
|
86497
|
86547
|
86561
|
86562
|
86577
|
86578
|
86632