[Koha-bugs] [Bug 25112] Koha::CirculationRules->set_rules should handle scopes per rule

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Jun 16 10:54:18 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25112

--- Comment #7 from Lari Taskula <lari.taskula at hypernova.fi> ---
(In reply to Jonathan Druart from comment #4)
> I think that's expected.
> That may make the caller codes confusing. Why do you need that?

This may be a matter of preference but I would expect "set_rules" method to
take all rules at once regardless of the developer having to study which set of
rules use the same set of scopes and then determine how many calls are
necessary. It should simply process all given rules with the scopes that they
are able to utilize. It reduces code repetition and makes adding new/modifying
scopes of existing rules easier because you don't have to split any of the
set_rules methods in parts.

A good example is in smart-rules.pl where we are repeating the calls multiple
times due to current restriction of set_rules. It looks bad and is quite
confusing to make changes to, especially when adding a new scope. I know this
page will eventually be removed but for the sake of future usability I propose
this change.

For visualization, here is the worst case with the current scopes and the
result after my proposed change:

Koha::CirculationRules->set_rules({
  branchcode => 'CPL',
  rules => {
    refund => 1
  }
})

Koha::CirculationRules->set_rules({
  branchcode => 'CPL',
  categorycode => 'PT',
  rules => {
    patron_maxissueqty => 1
  }
})

Koha::CirculationRules->set_rules({
  branchcode => 'CPL',
  itemtype => 'BK',
  rules => {
    holdallowed => 1
  }
})

Koha::CirculationRules->set_rules({
  branchcode => 'CPL',
  categorycode => 'PT'
  itemtype => 'BK',
  rules => {
    article_requests => 1
  }
})


vs proposed change:


Koha::CirculationRules->set_rules({
  branchcode => 'CPL',
  categorycode => 'PT'
  itemtype => 'BK',
  rules => {
    refund => 1
    patron_maxissueqty => 1
    holdallowed => 1,
    article_requests => 1
  }
})

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list