[Koha-bugs] [Bug 15836] Labels: Offer configuration option for splitting call numbers

2019-02-05 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Oliver Behnke  changed:

   What|Removed |Added

 CC||oliver.beh...@aei.mpg.de

--- Comment #94 from Oliver Behnke  ---
FYI, the DB schema changes in
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82289 are
incomplete/incorrect.

1) Table "class_sources" gets its "class_split_rule" pre-filled with the
existing "class_sort_rule" counterparts, yet the "class_split_rules" table is
only filled with fixed presets. Thus adding the "class_source_ibfk_2"
constraint will fail as soon as there are more sort rules than split rules,
that is, as soon as there are any custom sort rules.

2) The "class_split_rules" preset values are apparently copied from the
"class_sort_rules" rules, leaving the "sorting rules" fragment in their
descriptions. Those are presumably meant to be called "splitting rules".

Best,
Oliver

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2019-02-05 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #95 from Katrin Fischer  ---
(In reply to Oliver Behnke from comment #94)
> FYI, the DB schema changes in
> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82289 are
> incomplete/incorrect.
> 
> 1) Table "class_sources" gets its "class_split_rule" pre-filled with the
> existing "class_sort_rule" counterparts, yet the "class_split_rules" table
> is only filled with fixed presets. Thus adding the "class_source_ibfk_2"
> constraint will fail as soon as there are more sort rules than split rules,
> that is, as soon as there are any custom sort rules.
> 
> 2) The "class_split_rules" preset values are apparently copied from the
> "class_sort_rules" rules, leaving the "sorting rules" fragment in their
> descriptions. Those are presumably meant to be called "splitting rules".
> 
> Best,
> Oliver

Hi Oliver, can you please file this as a separate bug report and link to this
bug using the "Depends"? Once a bug is pushed, closed and released like this,
we always need a new one for tracking the change.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2019-02-05 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Oliver Behnke  changed:

   What|Removed |Added

 Blocks||22275


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22275
[Bug 22275] 18.06.00.060 DB update fails (incomplete/incorrect defaults)
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2019-02-05 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #96 from Oliver Behnke  ---
Done.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

Summary|Labels: Offer configuration |Labels: Offer configuration
   |option for splitting call   |option for splitting call
   |number in layout definition |numbers

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #7 from Jonathan Druart  
---
Created attachment 76696
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76696&action=edit
Screenshot of the feature

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-17 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #8 from Jonathan Druart  
---
Created attachment 77061
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77061&action=edit
Bug 15836: Add tests

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-17 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #9 from Jonathan Druart  
---
Just found this test file in my local repo. It sounds like it belongs to this
one...

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #10 from Jonathan Druart  
---
Created attachment 77079
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77079&action=edit
Bug 15836: Add missing svc script

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #11 from Katrin Fischer  ---
Hi Jonathan,

we have tested the basic functionality and are happy about the results of the
test button and the results in the generated PDF.

We also found some issues:

1) There is an error if you try to edit an existing non-Regex splitting rule:
Template process failed: undef error - malformed JSON string, neither array,
object, number, string or atom, at character offset 0 (before "(end of
string)") at /usr/share/perl5/JSON.pm line 171.
 at /home/vagrant/kohaclone/C4/Templates.pm line 122

2) If you try to print the PDF for labels with ddc/loc splitting rule, there is
also an error:
malformed JSON string, neither array, object, number, string or atom, at
character offset 0 (before "(end of string)") at /usr/share/perl5/JSON.pm line
171


We are not sure on how to solve the security issue. I think switching to TT
would not be good in this case, as it would be harder do write and people would
try to do more formatting that is probably not supported by the labels right
now.

Maybe an approach splitting the regex into muliple fields similar to the MARC
modification templates GUI could work. Instead of hardcoding /ig, maybe a pull
down? Open to your and others' suggestions.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #12 from Katrin Fischer  ---
> * Should not we use a LONGTEXT for class_split_rules.split_regex instead
> of VARCHAR(255)?

varchar(255) seems enough.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #13 from Jonathan Druart  
---
Created attachment 77306
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77306&action=edit
Bug 15836: Handle non-existent regexs

For other types of split rules

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #14 from Jonathan Druart  
---
(In reply to Katrin Fischer from comment #11)
> Hi Jonathan,

Hi Katrin, thanks for testing!

> we have tested the basic functionality and are happy about the results of
> the test button and the results in the generated PDF.

Good to hear :)

> We also found some issues:

Must be fixed with the last patch.

> We are not sure on how to solve the security issue. I think switching to TT
> would not be good in this case, as it would be harder do write and people
> would try to do more formatting that is probably not supported by the labels
> right now.
> 
> Maybe an approach splitting the regex into muliple fields similar to the
> MARC modification templates GUI could work. Instead of hardcoding /ig, maybe
> a pull down? Open to your and others' suggestions.

My guess it that MMT does not work with $1 either, I think we will also need /e
for that.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #15 from Katrin Fischer  ---
*** Bug 12201 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-07-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #16 from Katrin Fischer  ---
The last patch fixes the 2 errors.

Looking at the functionality, we are ready to sign-off, but worried about the
security issue.

If I understood correctly the use of $1 is related to the eval happening and it
won't work without. For the current use case, the line s/^(J|K)\n/$1 could be
replaced by 2 lines for K and J, not using $1. So we might be able to cut that
feature, if it would help.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-08-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

David Cook  changed:

   What|Removed |Added

 CC||dc...@prosentient.com.au

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-09-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #18 from Jonathan Druart  
---
Created attachment 78793
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78793&action=edit
Bug 15836: Add the ability to defined custom methods to split call number in
labels

Currently the call number splitting seems to be mostly implemented for
DDC and LC classifications.
Those are both not very common in some countries.
A lot of libraries use their own custom classification schemes so the call
number
plitting is something that should be individually configurable.

This enhancement adds the ability to define custom splitting rules based
on regular expressions.

How does it work so far?
>From C4/Labels/Label.pm there are 3 differents splitting methods defined,
depending on items.cn_source.
  if cn_source is "lcc' or 'nlm' we split using Library::CallNumber::LC
  if cn_source is 'ddc' we split using a in-house method
Finally there is a fallback method to split on space
And nothing else is done for other cn_source

The idea of this patch is to mimick what was done for the "filing rules" and
add
the ability to define "splitting rules" that will be used by the
"Classification sources".
A classification source will then have:
  * a filing rule used to sort items by callnumbers
  * a splitting rule used to print labels

To acchieve this goal this enhancement will do the following
modifications at DB level:
* New table class_split_rules
* New column class_sources.class_split_rule

Test plan:
* Execute the update database entry to create the new table and
column.
I. UI Changes
a) Create/modify/delete a filing rule
b) Create/modify/delete a splitting rule
c) Create/modify/delete a classification source
=> A filing rule or splitting rule cannot be removed if used by a
classification source

II. Splitting rule using regular expressions
a) Create a splitting rule using the "Splitting routine" "RegEx"
b) Define several regular expressions, they will be applied one after
the other in the same order you define them.
Something like:
  s/\s/\n/g # Break on spaces
  s/(\s?=)/\n=/g# Break on = (unless it's done already)
  s/^(J|K)\n/$1 /   # Remove the first break if callnumber starts with J or K
c) You can test the regular expressions using filling the textarea with
a list of callnumbers. Then click "Test" and confirm the callnumbers are
split how you expected.
d) Finally create a new classification source that will use this new
splitting rule.

III. Print the label!
a) Create a layout. It should have the "Split call numbers" checkbox
ticked, and display itemcallnumber
b) Use this layout to export labels, use items with different
classification source ('lcc', 'ddc', but also the new one you have
create)
=> The callnumbers should have been split according to the regex you
defined earlier!

Notes:
* The update database entry fill the class_sources.class_split_rule
with the value of class_sources.class_sort_rule
If default rules exist it will not work, we should add a note in the
release notes (would be enough?)
* C4::ClassSplitRoutine::* should be moved to Koha::ClassSplitRule,
but it sounded better to keep the same pattern as ClassSortRoutines
* Should not we use a LONGTEXT for class_split_rules.split_regex instead
of VARCHAR(255)?

* class_sources.sql should be filled for other languages before pushed
to master!

IMPORTANT NOTES: The regular expressions are stored as it, and eval is
used to evaluate it (perlcritic raises a warning about it (Expression
form of "eval"). It can lead to serious security issues (execution of
arbitrary code on the server), especially if the modifier 'e' is used.
We could then remedy the situation with one of these following points:
- Assume that this DB data is safe (We can add a new permission?)
- Assume that the data is not safe and deal with possible attack
Cons: how be sure we are exhaustive? Making sure it matches ^s///[^e/]*$
would be enough?
- Use Template Toolkit syntax instead (Really safer?)
  [% callnumber.replace('\s', '\n').replace ... %]
- Cut the regex parts: find, replace, modifiers
like we already do for Marc modification template. Cons: we are going to
have escape problems, the "find" and "replace" parts should not be
handle the same way (think "\n", "\\n", "\1", "\s", etc.)
I did not manage to implement this one easily.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-09-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #19 from Jonathan Druart  
---
Created attachment 78795
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78795&action=edit
Bug 15836: Mark C4::ClassSource subs DEPRECATED

These subs are no longer used from scripts and should be removed. It
should be done on a separate bug report given that additional work is
needed

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-09-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #76693|0   |1
is obsolete||
  Attachment #76694|0   |1
is obsolete||
  Attachment #76695|0   |1
is obsolete||
  Attachment #77061|0   |1
is obsolete||
  Attachment #77079|0   |1
is obsolete||
  Attachment #77306|0   |1
is obsolete||

--- Comment #17 from Jonathan Druart  
---
Created attachment 78791
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78791&action=edit
Bug 15836: UI changes

The script admin/classsources.pl has been adjusted to follow usual
patterns used in other Koha scripts.
$op can be add_source, add_source_validate, etc.
Deletion steps have been removed (there is a JS confirmation box) to
simplify both script and template.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-09-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #20 from Jonathan Druart  
---
Created attachment 78796
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78796&action=edit
Bug 15836: Add tests

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-09-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #21 from Jonathan Druart  
---
Created attachment 78798
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78798&action=edit
Bug 15836: Add missing svc script

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-09-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #22 from Jonathan Druart  
---
Created attachment 78799
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78799&action=edit
Bug 15836: Handle non-existent regexs

For other types of split rules

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-09-16 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #23 from Jonathan Druart  
---
Created attachment 79029
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=79029&action=edit
Bug 15836: Fix display input in any situations

Fix when switching an existing rule to RegEx

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

 Status|Needs Signoff   |Signed Off
 CC||sandbo...@ptfs-europe.com

--- Comment #24 from PTFS Europe Sandboxes  ---
Patch tested with a sandbox, by Christian Stelzenmüller


-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #76691|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #78791|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #76692|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #78795|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #78793|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #78798|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #78796|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #78799|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #25 from PTFS Europe Sandboxes  ---
Created attachment 80339
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80339&action=edit
Bug 15836: DB changes

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #26 from PTFS Europe Sandboxes  ---
Created attachment 80340
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80340&action=edit
Bug 15836: DBIC Schema change

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

PTFS Europe Sandboxes  changed:

   What|Removed |Added

  Attachment #79029|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #27 from PTFS Europe Sandboxes  ---
Created attachment 80341
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80341&action=edit
Bug 15836: UI changes

The script admin/classsources.pl has been adjusted to follow usual
patterns used in other Koha scripts.
$op can be add_source, add_source_validate, etc.
Deletion steps have been removed (there is a JS confirmation box) to
simplify both script and template.

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #30 from PTFS Europe Sandboxes  ---
Created attachment 80344
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80344&action=edit
Bug 15836: Add tests

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #33 from PTFS Europe Sandboxes  ---
Created attachment 80347
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80347&action=edit
Bug 15836: Fix display input in any situations

Fix when switching an existing rule to RegEx

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #28 from PTFS Europe Sandboxes  ---
Created attachment 80342
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80342&action=edit
Bug 15836: Add the ability to defined custom methods to split call number in
labels

Currently the call number splitting seems to be mostly implemented for
DDC and LC classifications.
Those are both not very common in some countries.
A lot of libraries use their own custom classification schemes so the call
number
plitting is something that should be individually configurable.

This enhancement adds the ability to define custom splitting rules based
on regular expressions.

How does it work so far?
From C4/Labels/Label.pm there are 3 differents splitting methods defined,
depending on items.cn_source.
  if cn_source is "lcc' or 'nlm' we split using Library::CallNumber::LC
  if cn_source is 'ddc' we split using a in-house method
Finally there is a fallback method to split on space
And nothing else is done for other cn_source

The idea of this patch is to mimick what was done for the "filing rules" and
add
the ability to define "splitting rules" that will be used by the
"Classification sources".
A classification source will then have:
  * a filing rule used to sort items by callnumbers
  * a splitting rule used to print labels

To acchieve this goal this enhancement will do the following
modifications at DB level:
* New table class_split_rules
* New column class_sources.class_split_rule

Test plan:
* Execute the update database entry to create the new table and
column.
I. UI Changes
a) Create/modify/delete a filing rule
b) Create/modify/delete a splitting rule
c) Create/modify/delete a classification source
=> A filing rule or splitting rule cannot be removed if used by a
classification source

II. Splitting rule using regular expressions
a) Create a splitting rule using the "Splitting routine" "RegEx"
b) Define several regular expressions, they will be applied one after
the other in the same order you define them.
Something like:
  s/\s/\n/g # Break on spaces
  s/(\s?=)/\n=/g# Break on = (unless it's done already)
  s/^(J|K)\n/$1 /   # Remove the first break if callnumber starts with J or K
c) You can test the regular expressions using filling the textarea with
a list of callnumbers. Then click "Test" and confirm the callnumbers are
split how you expected.
d) Finally create a new classification source that will use this new
splitting rule.

III. Print the label!
a) Create a layout. It should have the "Split call numbers" checkbox
ticked, and display itemcallnumber
b) Use this layout to export labels, use items with different
classification source ('lcc', 'ddc', but also the new one you have
create)
=> The callnumbers should have been split according to the regex you
defined earlier!

Notes:
* The update database entry fill the class_sources.class_split_rule
with the value of class_sources.class_sort_rule
If default rules exist it will not work, we should add a note in the
release notes (would be enough?)
* C4::ClassSplitRoutine::* should be moved to Koha::ClassSplitRule,
but it sounded better to keep the same pattern as ClassSortRoutines
* Should not we use a LONGTEXT for class_split_rules.split_regex instead
of VARCHAR(255)?

* class_sources.sql should be filled for other languages before pushed
to master!

IMPORTANT NOTES: The regular expressions are stored as it, and eval is
used to evaluate it (perlcritic raises a warning about it (Expression
form of "eval"). It can lead to serious security issues (execution of
arbitrary code on the server), especially if the modifier 'e' is used.
We could then remedy the situation with one of these following points:
- Assume that this DB data is safe (We can add a new permission?)
- Assume that the data is not safe and deal with possible attack
Cons: how be sure we are exhaustive? Making sure it matches ^s///[^e/]*$
would be enough?
- Use Template Toolkit syntax instead (Really safer?)
  [% callnumber.replace('\s', '\n').replace ... %]
- Cut the regex parts: find, replace, modifiers
like we already do for Marc modification template. Cons: we are going to
have escape problems, the "find" and "replace" parts should not be
handle the same way (think "\n", "\\n", "\1", "\s", etc.)
I did not manage to implement this one easily.

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #29 from PTFS Europe Sandboxes  ---
Created attachment 80343
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80343&action=edit
Bug 15836: Mark C4::ClassSource subs DEPRECATED

These subs are no longer used from scripts and should be removed. It
should be done on a separate bug report given that additional work is
needed

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #32 from PTFS Europe Sandboxes  ---
Created attachment 80346
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80346&action=edit
Bug 15836: Handle non-existent regexs

For other types of split rules

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #31 from PTFS Europe Sandboxes  ---
Created attachment 80345
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80345&action=edit
Bug 15836: Add missing svc script

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Katrin Fischer  changed:

   What|Removed |Added

 Depends on||14391


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14391
[Bug 14391] Granular permissions for the administration module
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Josef Moravec  changed:

   What|Removed |Added

 CC||josef.mora...@gmail.com
 Status|Signed Off  |Patch doesn't apply

--- Comment #34 from Josef Moravec  ---
Hi Jonathan, 

I have few questions:

1. Why do you decide to make new modules under C4 namespace? 

2. The patches are not applicable on top of bug 14931, should it depend on it?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #35 from Jonathan Druart  
---
(In reply to Josef Moravec from comment #34)
> Hi Jonathan, 
> 
> I have few questions:
> 
> 1. Why do you decide to make new modules under C4 namespace? 

I have mimicked what was done in C4::ClassSortRules. It sounded better to keep
them tied at the same place (ClassSource.pm, ClassSortRoutine.pm and
ClassSplitRoutine.pm)

> 2. The patches are not applicable on top of bug 14931, should it depend on
> it?

It's bug 14391, and it does not apply anymore. I will rebase on top when ready.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #37 from Jonathan Druart  
---
Created attachment 80549
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80549&action=edit
Bug 15836: DBIC Schema change

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

 Status|Patch doesn't apply |Signed Off

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #39 from Jonathan Druart  
---
Created attachment 80551
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80551&action=edit
Bug 15836: Add the ability to defined custom methods to split call number in
labels

Currently the call number splitting seems to be mostly implemented for
DDC and LC classifications.
Those are both not very common in some countries.
A lot of libraries use their own custom classification schemes so the call
number
plitting is something that should be individually configurable.

This enhancement adds the ability to define custom splitting rules based
on regular expressions.

How does it work so far?
From C4/Labels/Label.pm there are 3 differents splitting methods defined,
depending on items.cn_source.
  if cn_source is "lcc' or 'nlm' we split using Library::CallNumber::LC
  if cn_source is 'ddc' we split using a in-house method
Finally there is a fallback method to split on space
And nothing else is done for other cn_source

The idea of this patch is to mimick what was done for the "filing rules" and
add
the ability to define "splitting rules" that will be used by the
"Classification sources".
A classification source will then have:
  * a filing rule used to sort items by callnumbers
  * a splitting rule used to print labels

To acchieve this goal this enhancement will do the following
modifications at DB level:
* New table class_split_rules
* New column class_sources.class_split_rule

Test plan:
* Execute the update database entry to create the new table and
column.
I. UI Changes
a) Create/modify/delete a filing rule
b) Create/modify/delete a splitting rule
c) Create/modify/delete a classification source
=> A filing rule or splitting rule cannot be removed if used by a
classification source

II. Splitting rule using regular expressions
a) Create a splitting rule using the "Splitting routine" "RegEx"
b) Define several regular expressions, they will be applied one after
the other in the same order you define them.
Something like:
  s/\s/\n/g # Break on spaces
  s/(\s?=)/\n=/g# Break on = (unless it's done already)
  s/^(J|K)\n/$1 /   # Remove the first break if callnumber starts with J or K
c) You can test the regular expressions using filling the textarea with
a list of callnumbers. Then click "Test" and confirm the callnumbers are
split how you expected.
d) Finally create a new classification source that will use this new
splitting rule.

III. Print the label!
a) Create a layout. It should have the "Split call numbers" checkbox
ticked, and display itemcallnumber
b) Use this layout to export labels, use items with different
classification source ('lcc', 'ddc', but also the new one you have
create)
=> The callnumbers should have been split according to the regex you
defined earlier!

Notes:
* The update database entry fill the class_sources.class_split_rule
with the value of class_sources.class_sort_rule
If default rules exist it will not work, we should add a note in the
release notes (would be enough?)
* C4::ClassSplitRoutine::* should be moved to Koha::ClassSplitRule,
but it sounded better to keep the same pattern as ClassSortRoutines
* Should not we use a LONGTEXT for class_split_rules.split_regex instead
of VARCHAR(255)?

* class_sources.sql should be filled for other languages before pushed
to master!

IMPORTANT NOTES: The regular expressions are stored as it, and eval is
used to evaluate it (perlcritic raises a warning about it (Expression
form of "eval"). It can lead to serious security issues (execution of
arbitrary code on the server), especially if the modifier 'e' is used.
We could then remedy the situation with one of these following points:
- Assume that this DB data is safe (We can add a new permission?)
- Assume that the data is not safe and deal with possible attack
Cons: how be sure we are exhaustive? Making sure it matches ^s///[^e/]*$
would be enough?
- Use Template Toolkit syntax instead (Really safer?)
  [% callnumber.replace('\s', '\n').replace ... %]
- Cut the regex parts: find, replace, modifiers
like we already do for Marc modification template. Cons: we are going to
have escape problems, the "find" and "replace" parts should not be
handle the same way (think "\n", "\\n", "\1", "\s", etc.)
I did not manage to implement this one easily.

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #41 from Jonathan Druart  
---
Created attachment 80553
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80553&action=edit
Bug 15836: Add tests

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #38 from Jonathan Druart  
---
Created attachment 80550
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80550&action=edit
Bug 15836: UI changes

The script admin/classsources.pl has been adjusted to follow usual
patterns used in other Koha scripts.
$op can be add_source, add_source_validate, etc.
Deletion steps have been removed (there is a JS confirmation box) to
simplify both script and template.

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #80339|0   |1
is obsolete||
  Attachment #80340|0   |1
is obsolete||
  Attachment #80341|0   |1
is obsolete||
  Attachment #80342|0   |1
is obsolete||
  Attachment #80343|0   |1
is obsolete||
  Attachment #80344|0   |1
is obsolete||
  Attachment #80345|0   |1
is obsolete||
  Attachment #80346|0   |1
is obsolete||
  Attachment #80347|0   |1
is obsolete||

--- Comment #36 from Jonathan Druart  
---
Created attachment 80548
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80548&action=edit
Bug 15836: DB changes

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #40 from Jonathan Druart  
---
Created attachment 80552
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80552&action=edit
Bug 15836: Mark C4::ClassSource subs DEPRECATED

These subs are no longer used from scripts and should be removed. It
should be done on a separate bug report given that additional work is
needed

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #42 from Jonathan Druart  
---
Created attachment 80554
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80554&action=edit
Bug 15836: Add missing svc script

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #43 from Jonathan Druart  
---
Created attachment 80555
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80555&action=edit
Bug 15836: Handle non-existent regexs

For other types of split rules

Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #44 from Jonathan Druart  
---
Created attachment 80556
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80556&action=edit
Bug 15836: Fix display input in any situations

Fix when switching an existing rule to RegEx

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Christian Stelzenmüller 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

 Status|Signed Off  |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80548|0   |1
is obsolete||

--- Comment #45 from Chris Cormack  ---
Created attachment 81033
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81033&action=edit
Bug 15836: DB changes

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80550|0   |1
is obsolete||

--- Comment #47 from Chris Cormack  ---
Created attachment 81035
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81035&action=edit
Bug 15836: UI changes

The script admin/classsources.pl has been adjusted to follow usual
patterns used in other Koha scripts.
$op can be add_source, add_source_validate, etc.
Deletion steps have been removed (there is a JS confirmation box) to
simplify both script and template.

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80549|0   |1
is obsolete||

--- Comment #46 from Chris Cormack  ---
Created attachment 81034
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81034&action=edit
Bug 15836: DBIC Schema change

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80551|0   |1
is obsolete||

--- Comment #48 from Chris Cormack  ---
Created attachment 81036
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81036&action=edit
Bug 15836: Add the ability to defined custom methods to split call number in
labels

Currently the call number splitting seems to be mostly implemented for
DDC and LC classifications.
Those are both not very common in some countries.
A lot of libraries use their own custom classification schemes so the call
number
plitting is something that should be individually configurable.

This enhancement adds the ability to define custom splitting rules based
on regular expressions.

How does it work so far?
From C4/Labels/Label.pm there are 3 differents splitting methods defined,
depending on items.cn_source.
  if cn_source is "lcc' or 'nlm' we split using Library::CallNumber::LC
  if cn_source is 'ddc' we split using a in-house method
Finally there is a fallback method to split on space
And nothing else is done for other cn_source

The idea of this patch is to mimick what was done for the "filing rules" and
add
the ability to define "splitting rules" that will be used by the
"Classification sources".
A classification source will then have:
  * a filing rule used to sort items by callnumbers
  * a splitting rule used to print labels

To acchieve this goal this enhancement will do the following
modifications at DB level:
* New table class_split_rules
* New column class_sources.class_split_rule

Test plan:
* Execute the update database entry to create the new table and
column.
I. UI Changes
a) Create/modify/delete a filing rule
b) Create/modify/delete a splitting rule
c) Create/modify/delete a classification source
=> A filing rule or splitting rule cannot be removed if used by a
classification source

II. Splitting rule using regular expressions
a) Create a splitting rule using the "Splitting routine" "RegEx"
b) Define several regular expressions, they will be applied one after
the other in the same order you define them.
Something like:
  s/\s/\n/g # Break on spaces
  s/(\s?=)/\n=/g# Break on = (unless it's done already)
  s/^(J|K)\n/$1 /   # Remove the first break if callnumber starts with J or K
c) You can test the regular expressions using filling the textarea with
a list of callnumbers. Then click "Test" and confirm the callnumbers are
split how you expected.
d) Finally create a new classification source that will use this new
splitting rule.

III. Print the label!
a) Create a layout. It should have the "Split call numbers" checkbox
ticked, and display itemcallnumber
b) Use this layout to export labels, use items with different
classification source ('lcc', 'ddc', but also the new one you have
create)
=> The callnumbers should have been split according to the regex you
defined earlier!

Notes:
* The update database entry fill the class_sources.class_split_rule
with the value of class_sources.class_sort_rule
If default rules exist it will not work, we should add a note in the
release notes (would be enough?)
* C4::ClassSplitRoutine::* should be moved to Koha::ClassSplitRule,
but it sounded better to keep the same pattern as ClassSortRoutines
* Should not we use a LONGTEXT for class_split_rules.split_regex instead
of VARCHAR(255)?

* class_sources.sql should be filled for other languages before pushed
to master!

IMPORTANT NOTES: The regular expressions are stored as it, and eval is
used to evaluate it (perlcritic raises a warning about it (Expression
form of "eval"). It can lead to serious security issues (execution of
arbitrary code on the server), especially if the modifier 'e' is used.
We could then remedy the situation with one of these following points:
- Assume that this DB data is safe (We can add a new permission?)
- Assume that the data is not safe and deal with possible attack
Cons: how be sure we are exhaustive? Making sure it matches ^s///[^e/]*$
would be enough?
- Use Template Toolkit syntax instead (Really safer?)
  [% callnumber.replace('\s', '\n').replace ... %]
- Cut the regex parts: find, replace, modifiers
like we already do for Marc modification template. Cons: we are going to
have escape problems, the "find" and "replace" parts should not be
handle the same way (think "\n", "\\n", "\1", "\s", etc.)
I did not manage to implement this one easily.

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

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

[Koha-bugs] [Bug 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80552|0   |1
is obsolete||

--- Comment #49 from Chris Cormack  ---
Created attachment 81037
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81037&action=edit
Bug 15836: Mark C4::ClassSource subs DEPRECATED

These subs are no longer used from scripts and should be removed. It
should be done on a separate bug report given that additional work is
needed

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80553|0   |1
is obsolete||

--- Comment #50 from Chris Cormack  ---
Created attachment 81038
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81038&action=edit
Bug 15836: Add tests

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80554|0   |1
is obsolete||

--- Comment #51 from Chris Cormack  ---
Created attachment 81039
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81039&action=edit
Bug 15836: Add missing svc script

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80555|0   |1
is obsolete||

--- Comment #52 from Chris Cormack  ---
Created attachment 81040
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81040&action=edit
Bug 15836: Handle non-existent regexs

For other types of split rules

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Chris Cormack  changed:

   What|Removed |Added

  Attachment #80556|0   |1
is obsolete||

--- Comment #53 from Chris Cormack  ---
Created attachment 81041
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81041&action=edit
Bug 15836: Fix display input in any situations

Fix when switching an existing rule to RegEx

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #81033|0   |1
is obsolete||
  Attachment #81034|0   |1
is obsolete||
  Attachment #81035|0   |1
is obsolete||
  Attachment #81036|0   |1
is obsolete||
  Attachment #81037|0   |1
is obsolete||
  Attachment #81038|0   |1
is obsolete||
  Attachment #81039|0   |1
is obsolete||
  Attachment #81040|0   |1
is obsolete||
  Attachment #81041|0   |1
is obsolete||

--- Comment #54 from Jonathan Druart  
---
Created attachment 81627
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81627&action=edit
Bug 15836: DB changes

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #55 from Jonathan Druart  
---
Created attachment 81628
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81628&action=edit
Bug 15836: DBIC Schema change

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #56 from Jonathan Druart  
---
Created attachment 81629
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81629&action=edit
Bug 15836: UI changes

The script admin/classsources.pl has been adjusted to follow usual
patterns used in other Koha scripts.
$op can be add_source, add_source_validate, etc.
Deletion steps have been removed (there is a JS confirmation box) to
simplify both script and template.

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #58 from Jonathan Druart  
---
Created attachment 81631
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81631&action=edit
Bug 15836: Mark C4::ClassSource subs DEPRECATED

These subs are no longer used from scripts and should be removed. It
should be done on a separate bug report given that additional work is
needed

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #59 from Jonathan Druart  
---
Created attachment 81632
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81632&action=edit
Bug 15836: Add tests

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #57 from Jonathan Druart  
---
Created attachment 81630
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81630&action=edit
Bug 15836: Add the ability to defined custom methods to split call number in
labels

Currently the call number splitting seems to be mostly implemented for
DDC and LC classifications.
Those are both not very common in some countries.
A lot of libraries use their own custom classification schemes so the call
number
plitting is something that should be individually configurable.

This enhancement adds the ability to define custom splitting rules based
on regular expressions.

How does it work so far?
From C4/Labels/Label.pm there are 3 differents splitting methods defined,
depending on items.cn_source.
  if cn_source is "lcc' or 'nlm' we split using Library::CallNumber::LC
  if cn_source is 'ddc' we split using a in-house method
Finally there is a fallback method to split on space
And nothing else is done for other cn_source

The idea of this patch is to mimick what was done for the "filing rules" and
add
the ability to define "splitting rules" that will be used by the
"Classification sources".
A classification source will then have:
  * a filing rule used to sort items by callnumbers
  * a splitting rule used to print labels

To acchieve this goal this enhancement will do the following
modifications at DB level:
* New table class_split_rules
* New column class_sources.class_split_rule

Test plan:
* Execute the update database entry to create the new table and
column.
I. UI Changes
a) Create/modify/delete a filing rule
b) Create/modify/delete a splitting rule
c) Create/modify/delete a classification source
=> A filing rule or splitting rule cannot be removed if used by a
classification source

II. Splitting rule using regular expressions
a) Create a splitting rule using the "Splitting routine" "RegEx"
b) Define several regular expressions, they will be applied one after
the other in the same order you define them.
Something like:
  s/\s/\n/g # Break on spaces
  s/(\s?=)/\n=/g# Break on = (unless it's done already)
  s/^(J|K)\n/$1 /   # Remove the first break if callnumber starts with J or K
c) You can test the regular expressions using filling the textarea with
a list of callnumbers. Then click "Test" and confirm the callnumbers are
split how you expected.
d) Finally create a new classification source that will use this new
splitting rule.

III. Print the label!
a) Create a layout. It should have the "Split call numbers" checkbox
ticked, and display itemcallnumber
b) Use this layout to export labels, use items with different
classification source ('lcc', 'ddc', but also the new one you have
create)
=> The callnumbers should have been split according to the regex you
defined earlier!

Notes:
* The update database entry fill the class_sources.class_split_rule
with the value of class_sources.class_sort_rule
If default rules exist it will not work, we should add a note in the
release notes (would be enough?)
* C4::ClassSplitRoutine::* should be moved to Koha::ClassSplitRule,
but it sounded better to keep the same pattern as ClassSortRoutines
* Should not we use a LONGTEXT for class_split_rules.split_regex instead
of VARCHAR(255)?

* class_sources.sql should be filled for other languages before pushed
to master!

IMPORTANT NOTES: The regular expressions are stored as it, and eval is
used to evaluate it (perlcritic raises a warning about it (Expression
form of "eval"). It can lead to serious security issues (execution of
arbitrary code on the server), especially if the modifier 'e' is used.
We could then remedy the situation with one of these following points:
- Assume that this DB data is safe (We can add a new permission?)
- Assume that the data is not safe and deal with possible attack
Cons: how be sure we are exhaustive? Making sure it matches ^s///[^e/]*$
would be enough?
- Use Template Toolkit syntax instead (Really safer?)
  [% callnumber.replace('\s', '\n').replace ... %]
- Cut the regex parts: find, replace, modifiers
like we already do for Marc modification template. Cons: we are going to
have escape problems, the "find" and "replace" parts should not be
handle the same way (think "\n", "\\n", "\1", "\s", etc.)
I did not manage to implement this one easily.

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #60 from Jonathan Druart  
---
Created attachment 81633
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81633&action=edit
Bug 15836: Add missing svc script

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #62 from Jonathan Druart  
---
Created attachment 81635
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81635&action=edit
Bug 15836: Fix display input in any situations

Fix when switching an existing rule to RegEx

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #61 from Jonathan Druart  
---
Created attachment 81634
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81634&action=edit
Bug 15836: Handle non-existent regexs

For other types of split rules

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #63 from Jonathan Druart  
---
I have added the "Sponsored-by" line" to the patches.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #64 from Katrin Fischer  ---
Thank you, Joubu!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-07 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Kelly D  changed:

   What|Removed |Added

 CC||ke...@flo.org

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #65 from Jonathan Druart  
---
Created attachment 82110
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82110&action=edit
Bug 15836: Fix update DB entry

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #67 from Jonathan Druart  
---
Created attachment 82113
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82113&action=edit
Bug 15836: DBIC Schema change

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #81628|0   |1
is obsolete||

--- Comment #66 from Jonathan Druart  
---
Created attachment 82112
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82112&action=edit
Bug 15836: Fix DB structure

That was a leftover from the first approach, this table must not be
modified!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #82110|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #70 from Katrin Fischer  ---
Created attachment 82120
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82120&action=edit
Bug 15836: (follow-up) Fix filters

Signed-off-by: Katrin Fischer 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Katrin Fischer  changed:

   What|Removed |Added

  Attachment #82112|0   |1
is obsolete||

--- Comment #68 from Katrin Fischer  ---
Created attachment 82118
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82118&action=edit
Bug 15836: Fix DB structure

That was a leftover from the first approach, this table must not be
modified!

Signed-off-by: Katrin Fischer 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Katrin Fischer  changed:

   What|Removed |Added

  Attachment #82113|0   |1
is obsolete||

--- Comment #69 from Katrin Fischer  ---
Created attachment 82119
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82119&action=edit
Bug 15836: DBIC Schema change

Signed-off-by: Katrin Fischer 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #71 from Katrin Fischer  ---
Retested on a fresh database created running the web installer with all sample
data.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Nick Clemens  changed:

   What|Removed |Added

 CC||n...@bywatersolutions.com
   Keywords||rel_18_11_candidate

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Nick Clemens  changed:

   What|Removed |Added

 Status|Passed QA   |Failed QA

--- Comment #72 from Nick Clemens  ---
I tried my best here but am still having issues

Minor conflicts on filters

After this patch I cannot delete classification sources, I end up on a blank
page

There is debug code in /home/vagrant/kohaclone/svc/split_callnumbers (Data
printer line 14)

I cannot save regex rules - I can add and test, but they are lost when I hit
save.

Possibly I messed up something when fixing filters, can you please double
check?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #79 from Jonathan Druart  
---
Created attachment 82295
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82295&action=edit
Bug 15836: Handle non-existent regexs

For other types of split rules

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #85 from Jonathan Druart  
---
Created attachment 82301
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82301&action=edit
Bug 15836: Remove debug statement

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #82 from Jonathan Druart  
---
Created attachment 82298
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82298&action=edit
Bug 15836: DBIC Schema change

Signed-off-by: Katrin Fischer 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #80 from Jonathan Druart  
---
Created attachment 82296
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82296&action=edit
Bug 15836: Fix display input in any situations

Fix when switching an existing rule to RegEx

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #76 from Jonathan Druart  
---
Created attachment 82292
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82292&action=edit
Bug 15836: Mark C4::ClassSource subs DEPRECATED

These subs are no longer used from scripts and should be removed. It
should be done on a separate bug report given that additional work is
needed

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #83 from Jonathan Druart  
---
Created attachment 82299
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82299&action=edit
Bug 15836: (follow-up) Fix filters

Signed-off-by: Katrin Fischer 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

 Status|Failed QA   |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #78 from Jonathan Druart  
---
Created attachment 82294
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82294&action=edit
Bug 15836: Add missing svc script

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #81627|0   |1
is obsolete||
  Attachment #81629|0   |1
is obsolete||
  Attachment #81630|0   |1
is obsolete||
  Attachment #81631|0   |1
is obsolete||
  Attachment #81632|0   |1
is obsolete||
  Attachment #81633|0   |1
is obsolete||
  Attachment #81634|0   |1
is obsolete||
  Attachment #81635|0   |1
is obsolete||
  Attachment #82118|0   |1
is obsolete||
  Attachment #82119|0   |1
is obsolete||
  Attachment #82120|0   |1
is obsolete||

--- Comment #73 from Jonathan Druart  
---
Created attachment 82289
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82289&action=edit
Bug 15836: DB changes

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #74 from Jonathan Druart  
---
Created attachment 82290
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82290&action=edit
Bug 15836: UI changes

The script admin/classsources.pl has been adjusted to follow usual
patterns used in other Koha scripts.
$op can be add_source, add_source_validate, etc.
Deletion steps have been removed (there is a JS confirmation box) to
simplify both script and template.

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #75 from Jonathan Druart  
---
Created attachment 82291
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82291&action=edit
Bug 15836: Add the ability to defined custom methods to split call number in
labels

Currently the call number splitting seems to be mostly implemented for
DDC and LC classifications.
Those are both not very common in some countries.
A lot of libraries use their own custom classification schemes so the call
number
plitting is something that should be individually configurable.

This enhancement adds the ability to define custom splitting rules based
on regular expressions.

How does it work so far?
From C4/Labels/Label.pm there are 3 differents splitting methods defined,
depending on items.cn_source.
  if cn_source is "lcc' or 'nlm' we split using Library::CallNumber::LC
  if cn_source is 'ddc' we split using a in-house method
Finally there is a fallback method to split on space
And nothing else is done for other cn_source

The idea of this patch is to mimick what was done for the "filing rules" and
add
the ability to define "splitting rules" that will be used by the
"Classification sources".
A classification source will then have:
  * a filing rule used to sort items by callnumbers
  * a splitting rule used to print labels

To acchieve this goal this enhancement will do the following
modifications at DB level:
* New table class_split_rules
* New column class_sources.class_split_rule

Test plan:
* Execute the update database entry to create the new table and
column.
I. UI Changes
a) Create/modify/delete a filing rule
b) Create/modify/delete a splitting rule
c) Create/modify/delete a classification source
=> A filing rule or splitting rule cannot be removed if used by a
classification source

II. Splitting rule using regular expressions
a) Create a splitting rule using the "Splitting routine" "RegEx"
b) Define several regular expressions, they will be applied one after
the other in the same order you define them.
Something like:
  s/\s/\n/g # Break on spaces
  s/(\s?=)/\n=/g# Break on = (unless it's done already)
  s/^(J|K)\n/$1 /   # Remove the first break if callnumber starts with J or K
c) You can test the regular expressions using filling the textarea with
a list of callnumbers. Then click "Test" and confirm the callnumbers are
split how you expected.
d) Finally create a new classification source that will use this new
splitting rule.

III. Print the label!
a) Create a layout. It should have the "Split call numbers" checkbox
ticked, and display itemcallnumber
b) Use this layout to export labels, use items with different
classification source ('lcc', 'ddc', but also the new one you have
create)
=> The callnumbers should have been split according to the regex you
defined earlier!

Notes:
* The update database entry fill the class_sources.class_split_rule
with the value of class_sources.class_sort_rule
If default rules exist it will not work, we should add a note in the
release notes (would be enough?)
* C4::ClassSplitRoutine::* should be moved to Koha::ClassSplitRule,
but it sounded better to keep the same pattern as ClassSortRoutines
* Should not we use a LONGTEXT for class_split_rules.split_regex instead
of VARCHAR(255)?

* class_sources.sql should be filled for other languages before pushed
to master!

IMPORTANT NOTES: The regular expressions are stored as it, and eval is
used to evaluate it (perlcritic raises a warning about it (Expression
form of "eval"). It can lead to serious security issues (execution of
arbitrary code on the server), especially if the modifier 'e' is used.
We could then remedy the situation with one of these following points:
- Assume that this DB data is safe (We can add a new permission?)
- Assume that the data is not safe and deal with possible attack
Cons: how be sure we are exhaustive? Making sure it matches ^s///[^e/]*$
would be enough?
- Use Template Toolkit syntax instead (Really safer?)
  [% callnumber.replace('\s', '\n').replace ... %]
- Cut the regex parts: find, replace, modifiers
like we already do for Marc modification template. Cons: we are going to
have escape problems, the "find" and "replace" parts should not be
handle the same way (think "\n", "\\n", "\1", "\s", etc.)
I did not manage to implement this one easily.

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #77 from Jonathan Druart  
---
Created attachment 82293
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82293&action=edit
Bug 15836: Add tests

Sponsored-by: Goethe-Institut

Signed-off-by: Christian Stelzenmüller 
Signed-off-by: Chris Cormack 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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 15836] Labels: Offer configuration option for splitting call numbers

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15836

--- Comment #81 from Jonathan Druart  
---
Created attachment 82297
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82297&action=edit
Bug 15836: Fix DB structure

That was a leftover from the first approach, this table must not be
modified!

Signed-off-by: Katrin Fischer 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


  1   2   >