[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2024-01-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

Katrin Fischer  changed:

   What|Removed |Added

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

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-06-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

Andrew Nugged  changed:

   What|Removed |Added

 Status|Needs Signoff   |In Discussion

--- Comment #7 from Andrew Nugged  ---
But that's not only about the assignment of $RULE_KINDS on the beginning,
$scope3 also used in the code further, in two places:

>+my $scope3 = [ 'branchcode', 'categorycode', 'itemtype' ];
...

> my $order_by = $params->{order_by}
>-  // { -desc => [ 'branchcode', 'categorycode', 'itemtype' ] };
>+  // { -desc => $scope3 };
...

> # Enforce scope; a rule should be set for its defined scope, no more, no 
> less.
>-foreach my $scope_level ( qw( branchcode categorycode itemtype ) ) {
>+foreach my $scope_level ( @$scope3 ) {
> if ( grep /$scope_level/, @{ $kind_info->{scope} } ) {

so just making pairs rules/scopes won't solve this, more advanced refactoring
then needed. Let's think about this, yes (just thinking aloud here too :) ).

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-06-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

--- Comment #6 from Jonathan Druart  
---
What about the following?

$scopes => [
  {
scope => [ qw( branchcode ) ],
rules => [ qw( refund ) ],
  },
  {
scope => [ qw( branchcode categorycode ) ],
rules => [ qw( patron_maxissueqty patron_maxonsiteissueqty max_holds ... )
],
  },
...
  {
scope => [ qw( branchcode categorycode itemtype ) ],
rules => [ qw( article_requests auto_renew cap_fine_to_replacement_price
...) ],
  },
];

ie you define using a different structure, then you "revert" it to generate the
existing structure.

Don't implement it yet, I am not sure I agree with myself :D

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-06-07 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

--- Comment #5 from Andrew Nugged  ---
Here we need to have more filtering criteria for smart-rules. For Finnish
libraries, we added "ccode" and "sleving_location", two extra smart rule
filters
(but by the way also later we propose this for the community version)

so we had before:

my $scope3 =
[ 'branchcode', 'categorycode', 'itemtype' ];

but now we have in our case:

my $scope3 =
[ 'branchcode', 'categorycode', 'itemtype', 'ccode',
'shelving_location' ];

and because of having only a single variable, we don't need to change any
variable names down in the file, nor copy-paste dozen times like it is now the
same array copypasted everywhere.




But now proposal from Jonathan to name it something like
"$branch_category_itemtype" will make this:

my $branch_category_itemtype =
[ 'branchcode', 'categorycode', 'itemtype' ];

becoming this (???):

my $branch_category_itemtype_ccode_shelving_location =
[ 'branchcode', 'categorycode', 'itemtype', 'ccode',
'shelving_location' ]; 

so when we add two extra items, we should again change all the code down below
to the new variable name $branch_category_itemtype_ccode_shelving_location?
Yikes!


That's why we voting for "$scope3",
because we have three scope sections, even logically separated: small one,
middle, and full.

... Oh, or let's name it "$scope_full" if you ok?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-06-07 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

--- Comment #4 from Katrin Fischer  ---
Hi Peter, can you explain about your future needs?

At the moment I am with Jonathan, I think readability is to be preferred, even
if resulting in more code.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-06-05 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

--- Comment #3 from Peter Vashchuk  ---
Yeah I thought about naming them similarly to what you proposed but it would
undermine some decisions that were taken into consideration during refactor.

The thing is, we need to add another item to "scope3" for Koha Finland, if we
name those arrays something like I already did (scope1, scope2, scope3) all it
requires is to add another item to array and we’re done, but if we rename those
arrays like you suggested (branch_category, branch_itemtype,
branch_category_itemtype) it will complicate things if we ever need to add any
other element to any of those arrays.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-06-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

Jonathan Druart  changed:

   What|Removed |Added

 CC||jonathan.dru...@bugs.koha-c
   ||ommunity.org

--- Comment #2 from Jonathan Druart  
---
Hum, I am going to ask myself "what it scope2 again?" for years :)

I agree we could have that in a variable, but be more explicit:
 b_c, b_i, b_c_i
or, even better IMO:
 branch_category, branch_itemtype, branch_category_itemtype

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-05-20 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

Peter Vashchuk  changed:

   What|Removed |Added

 CC||nug...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-05-20 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

Peter Vashchuk  changed:

   What|Removed |Added

 CC||slavashish...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-05-20 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

--- Comment #1 from Peter Vashchuk  ---
Created attachment 105154
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105154&action=edit
Bug 25554: Refactor rule kinds assignments in CirculationRules.pm

CirculationRules.pm have repeated code with the same values assigned many times
to rule kinds and also same hardcoded values appear in foreach loop.
Refactored by creating arrays once and then assigning and looping their values.

Mentored-by: Andrew Nugged 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 25554] Refactor rule kinds assignments in CirculationRules.pm

2020-05-20 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25554

Peter Vashchuk  changed:

   What|Removed |Added

 Status|ASSIGNED|Needs Signoff

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/