Bug 7621

Summary: Circulation: Match age restriction of title with borrower's age without using categories
Product: Koha Reporter: Marc Véron <veron>
Component: CirculationAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Mason James <mtj>
Severity: enhancement    
Priority: P1 - high CC: chris, gmcharlt, jonathan.druart, marc, mtj, nengard, paul.poulain, stephane.delaye, veron, wizzyrea
Version: 3.10   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 7621 [ENH]- Circulation: Match age restriction of title with borrower's age without using categories
Bug 7621 [ENH]- Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
[REBASED] BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
[PATCH] BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
Bug 7621 . Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
[SIGNED-OFF] BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
Bug 7621: Followup: FIX warnings "Scalar value @values[$take] better written as $values[$take]"
[SIGNED-OFF] Bug 7621: Followup: FIX warnings "Scalar value @values[$take] better written as $values[$take]"
Screenshots regarding usage
Bug 7621: Follow up to clarify preference language
Bug 7621: Follow up to clarify preference language
[SIGNED-OFF] Bug 7621: Follow up to clarify preference language

Description Marc Véron 2012-02-29 14:55:59 UTC
The problem
-----------
Public libraries and school libraries often have to deal with a lot of age restrictions, e.g. wit FSK (see www.fsk.de) or PEGI (Pan European Game Information, see www.pegi.info) and/or with regional rules regarding movies (virtually every canton in Switzerland has it's own rules). 

The classic way to implement age restrictions is to make use of a lot of categories. This gets soon very complicated, and is not easily maintainable. The librarians need an easy way to maintain age restrictions per title, otherwise they will not accept Koha.

I tried to find a robust ad easily configurable way to match age restriction against the borrower's age. I implemented it on my test server.

The concept
-----------
1) 
Have information about age restriction in field 521 a (Target audience)
The entry can be anywhere in the field. It reads like
PEGI 3 or FSK 12 (or any other 'tag' + age).

2)
Have a preference like 'AgeRestrictionTags' where such tags are defined. It is a text field with a list like
PEGI,FSK,Age...
(Make things robust by accepting ,;: and space as delimiters...)

3)
In circulation.pm, sub CanBookBeIssued, fetch the value from 521 a using the tags above. If the text after such tag is numeric, take this value as $restrictionyear. Add the years to the borrower's birth date. If the resulting date is in the future ( >today) , issuing is blocked by setting
$issuingimpossible{AGE_RESTRICTION} =  $restrictionyear;

4)
In circulation.tt, part , add:

[% IF ( AGE_RESTRICTION ) %]
   <li>Age restriction [% AGE_RESTRICTION %]</li>
[% END %]	

Result
-------
If a borrower tries to check out a restricted book and does not have the appropriate age, the circulation module will block the check out and issue a message like
"Age restriction 12"
Comment 1 Liz Rea 2012-02-29 16:54:28 UTC
I might add that it might be helpful to have this for "canBookBeReserved" as well.
Comment 2 Marc Véron 2012-02-29 18:08:30 UTC
(In reply to comment #1)
> I might add that it might be helpful to have this for "canBookBeReserved" as
> well.

It seems that CanBookBeReserved works on borrower and item data only (in Reserves.pm it loops through items and calls CanItemBeReserved ).

The first idea would be to let CanBookBeReserved call CanBookBeIssued as well, but in this case at least the parameter handling of CanBookBeIssued would need  modifications. It might even be necessary to break down CanBookBeIssued to several single sub routines (for each check one). This way, CanBokBeReserved and CanBookBeIssued could call the sub routines as appropriate.

I think this would lead to some bigger architectural modifications.

My proposition is to implement the functionality for CanBookBeIssued in a first step and to do the integration with CanBookBeIssued later.
Comment 3 Chris Cormack 2012-02-29 18:11:14 UTC
Please make sure you wrap the behavior with a syspref so its only called for libraries that want it. Because it will cause a slight performance hit.
Comment 4 Marc Véron 2012-02-29 19:24:20 UTC
(In reply to comment #3)
> Please make sure you wrap the behavior with a syspref so its only called for
> libraries that want it. Because it will cause a slight performance hit.

I can do this with checking first 
 C4::Context->preference('AgeRestrictionTags' )

If it is emtty, skip.
Comment 5 Ian Walls 2012-03-02 16:26:57 UTC
Some additional considerations:

1) The MARC field and subfield for age restriction needs to be configurable, so it can accommodate MARC21, UNIMARC and NORMARC equally.  Note that Restrictions on Access are recorded in 506 in MARC21. UNIMARC 333 (Notes Pertaining to Users/Intended Audience) may be the best fit on that side.

2) A single delimiter for acceptable tags should be decided on.  I recommend | to be consistent with other system preferences.  Space should not be used, as someone will undoubtedly want to use a two-word tag (like "Age Restriction:").

3) The behaviour should be configurable as to whether it completely blocks circ (issuingimpossible) or just prompts a confirmation box (needsconfirmation), since not every library will want to have this be a hard and fast rule.

4) Once DOM biblio indexing is in place, doing a numeric index on age restriction would make it searchable in the OPAC (and facetable, perhaps even with an "age appropriate for me?" facet for logged in users).

5) Should age restrictions interact at all with Analytics (passing through from serial record to monographic record)?
Comment 6 Marc Véron 2012-03-03 00:30:27 UTC
I have implemented Ian Walls' suggestions #1-#3 on my server.

Preferences in Section "Checkout Policy" read like this:

2 Fields:
AgeRestrictionField AgeRestrictionSubField [   ] [   ] Marc field / subfield for age restriction. E.g. 521 a (Empty AgeRestrictionField - Do not apply age restriction) 

1 Field:
AgeRestrictionMarker [   ] E.g. FSK|PEGI|Age| (No white space near |). Entry in Marc e.g. PEGI 6 (Empty - Do not apply age restriction)

1 Drop down list:
AgeRestrictionOverride [Prevent | Don't prevent] patrons from checking out an item whose age restriction would apply.
Comment 7 Marc Véron 2012-04-13 12:55:17 UTC Comment hidden (obsolete)
Comment 8 Chris Cormack 2012-04-14 08:53:02 UTC
I like the idea, but the patch is missing a few little things.

It needs to do an updatedatabase.pl to add the syspref to the database, as well as updating the syspref.sql 

Another issue is the use of SELECT ExtractValue, this will fail on older mysql versions (pre 5.1) and is slow. It might be better to adapt the frameworks to link the MARC field to a column in biblioitems. Since you have all the columns in biblioitems available anyway. 
This would mean it would be the same query whatever MARC flavour, as the appropriate subfield would be linked to the column.

Just a thought.
Comment 9 Marc Véron 2012-04-16 16:37:23 UTC
I'm implementing Chris' suggestions, please do not use the patch.
Comment 10 Marc Véron 2012-04-16 20:36:55 UTC Comment hidden (obsolete)
Comment 11 Chris Cormack 2012-04-17 09:05:35 UTC
I'd like to sign off, but since I recommended the changes probably best if someone else does :)
Comment 12 Marc Véron 2012-06-08 08:02:10 UTC Comment hidden (obsolete)
Comment 13 Marc Véron 2012-06-08 08:07:49 UTC
Previous patch did not longer apply. Remade patch and tested.
Would be nice if somebody could sign off - thanks!
Comment 14 Chris Cormack 2012-06-10 10:37:27 UTC Comment hidden (obsolete)
Comment 15 Chris Cormack 2012-06-10 10:38:11 UTC
Works well, has no effect unless the syspref is on. Safe change.
Comment 16 Paul Poulain 2012-06-10 12:40:01 UTC
QA comment: Fails QA for 2 reason, plus one request
 * Your patch introduce a perlcritic error:
C4/Circulation.pm: Integer with leading zeros: "02" at line 976, column 41.  See page 58 of PBP.  (Severity: 5)

 * The description of the syspref look a little bit too complex to me: "Do not prevent patrons from checking out an item whose age restriction would apply". Saying "No" means "do not not prevent from ..." That's a typical "no-no" thing. It's much readable to have a yes-yes: "Prevent patrons from checking out..." "Yes/No".

 * for existing setups, it will be necessary to do some manual operations:
   - Add the Age Restriction marker and link it to biblioitems.agerestriction
   - if the Age Rescrition marker is already here, an UPDATE will be needed (something like "UPDATE biblioitems SET agerestriction=ExtractValue('@521$a',marcxml)") to fill the new biblioitems field
  That's worth adding a wiki page describing that and pointing to it during updatedatabase (I'll take care of this in the Release Notes as well)

Note that this script is MARCflavour agnostic, so it should work in UNIMARC as well, (probably with field 333)
Comment 17 Marc Véron 2012-06-10 15:56:36 UTC Comment hidden (obsolete)
Comment 18 Marc Véron 2012-06-11 06:09:07 UTC Comment hidden (obsolete)
Comment 19 Marc Véron 2012-06-11 06:43:10 UTC Comment hidden (obsolete)
Comment 20 Marc Véron 2012-06-11 06:48:25 UTC Comment hidden (obsolete)
Comment 21 Marc Véron 2012-06-11 06:54:57 UTC Comment hidden (obsolete)
Comment 22 Marc Véron 2012-06-11 06:57:09 UTC
Finally I got all files :-)
Comment 23 Marc Véron 2012-06-21 05:47:29 UTC Comment hidden (obsolete)
Comment 24 delaye 2012-06-27 13:49:04 UTC
i test with a sandbox and an UNIMARC database; i use the tag 333$a where i enter the valeur FSK 16

but it didn't work : the young can checkout the issue.
I must update biblioitems.agerestriction ? i must enter un flag in this new column ?...

thank you for more information
Comment 25 Marc Véron 2012-06-27 14:00:18 UTC
Hi Stephane,

Thank you for testing!

I se that teh wiki link is broken, it should be:
http://wiki.koha-community.org/wiki/Age_restriction

Did you follow the steps there?

Marc
Comment 26 Marc Véron 2012-06-27 14:05:38 UTC
Ah I see you are testing in a sandbox. Maybe the prolbem is that you cann not update the database:

--Snip Wiki -------
If you use the patch, make sure that you have a column 'agerestriction' in table biblioitems. This will be handled by updatedatabase.pl. If you want to insert the column using mysql, you can do:

ALTER TABLE biblioitems ADD COLUMN 'agerestriction' VARCHAR(255) DEFAULT NULL AFTER 'cn_sort' 
--End Snip Wiki -------
Comment 27 delaye 2012-06-27 14:07:16 UTC
after apply the patch i can't update the system preference AgeRestrictionMarker and AgeRestrictionOverride 

i see the system preference in koha but une the table sql  systempreferences i don't see them
Comment 28 Marc Véron 2012-06-27 14:20:24 UTC
If the field 'agerestriction'is not in the table, you should run:

installer/data/mysql/updatedatabase.pl

or as alternative you can do the update directly using the following MySQL statement:

ALTER TABLE biblioitems ADD COLUMN 'agerestriction' VARCHAR(255) DEFAULT NULL AFTER 'cn_sort' ;
 
Can you do that in the sandbox?
Comment 29 delaye 2012-06-27 14:52:26 UTC
mysql> desc biblioitems;
+-----------------------+--------------+------+-----+-------------------+-----------------------------+
| Field                 | Type         | Null | Key | Default           | Extra                       |
+-----------------------+--------------+------+-----+-------------------+-----------------------------+
| biblioitemnumber      | int(11)      | NO   | PRI | NULL              | auto_increment              |
| biblionumber          | int(11)      | NO   | MUL | 0                 |                             |
| volume                | mediumtext   | YES  |     | NULL              |                             |
| number                | mediumtext   | YES  |     | NULL              |                             |
| itemtype              | varchar(10)  | YES  |     | NULL              |                             |
| isbn                  | varchar(30)  | YES  | MUL | NULL              |                             |
| issn                  | varchar(9)   | YES  | MUL | NULL              |                             |
| ean                   | varchar(13)  | YES  | MUL | NULL              |                             |
| publicationyear       | text         | YES  |     | NULL              |                             |
| publishercode         | varchar(255) | YES  | MUL | NULL              |                             |
| volumedate            | date         | YES  |     | NULL              |                             |
| volumedesc            | text         | YES  |     | NULL              |                             |
| collectiontitle       | mediumtext   | YES  |     | NULL              |                             |
| collectionissn        | text         | YES  |     | NULL              |                             |
| collectionvolume      | mediumtext   | YES  |     | NULL              |                             |
| editionstatement      | text         | YES  |     | NULL              |                             |
| editionresponsibility | text         | YES  |     | NULL              |                             |
| timestamp             | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| illus                 | varchar(255) | YES  |     | NULL              |                             |
| pages                 | varchar(255) | YES  |     | NULL              |                             |
| notes                 | mediumtext   | YES  |     | NULL              |                             |
| size                  | varchar(255) | YES  |     | NULL              |                             |
| place                 | varchar(255) | YES  |     | NULL              |                             |
| lccn                  | varchar(25)  | YES  |     | NULL              |                             |
| marc                  | longblob     | YES  |     | NULL              |                             |
| url                   | varchar(255) | YES  |     | NULL              |                             |
| cn_source             | varchar(10)  | YES  |     | NULL              |                             |
| cn_class              | varchar(30)  | YES  |     | NULL              |                             |
| cn_item               | varchar(10)  | YES  |     | NULL              |                             |
| cn_suffix             | varchar(10)  | YES  |     | NULL              |                             |
| cn_sort               | varchar(30)  | YES  |     | NULL              |                             |
| agerestriction        | varchar(250) | YES  |     | NULL              |                             |
| totalissues           | int(10)      | YES  |     | NULL              |                             |
| marcxml               | longtext     | NO   |     | NULL              |                             |
+-----------------------+--------------+------+-----+-------------------+----------------

INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionMarker','','Markers for age restriction indication, e.g. FSK|PEGI|Age|. See: http://wiki.koha-community.org/wiki/Age_restriction',NULL,'free');

INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionOverride',0,'Allow staff to check out an item with age restriction.',NULL,'YesNo');

select * from biblioitems where biblionumber=1979\G
*************************** 1. row ***************************
     biblioitemnumber: 1979
         biblionumber: 1979
               volume: NULL
               number: NULL
             itemtype: LIVR
                 isbn: 2869672020
                 issn: NULL
                  ean: NULL
      publicationyear: 1993
        publishercode: Vents d'ouest
           volumedate: NULL
           volumedesc: NULL
      collectiontitle: Grand large.
       collectionissn: NULL
     collectionvolume: NULL
     editionstatement: NULL
editionresponsibility: NULL
            timestamp: 2012-06-27 16:41:24
                illus: NULL
                pages: 46 p.
                notes: NULL
                 size: 30 cm
                place: NULL
                 lccn: NULL
                 marc: 00516     2200193   45000010005000000100021000050900009000261000041000352000073000762100024001492150034001732250023002071010008002306150012002386760007002503330011002577000026002687010028002941979  a2869672020d6.10  a1979  a20020311              frey50        1 aLe vol des urubus : La fièvre de l'ordtome 2fEric GutierrezbLIVR 1cVents d'ouestd1993 1a46 p.cBande dessinéed30 cm1 aGrand large.vN°2  afre  aFiction 1aBD  aFSK 16 192508aGutierrezbEric 192509aMigeatbFrançois
                  url: NULL
            cn_source: NULL
             cn_class: NULL
              cn_item: NULL
            cn_suffix: NULL
              cn_sort: 
       agerestriction: FSK 16
          totalissues: NULL


BUT the user  who have 14 years can chekout the biblionumber 1979
Comment 30 Marc Véron 2012-06-27 15:06:32 UTC
What is in the Preferences 
AgeRestrictionMarker
and 
AgeRestrictionOverride ?
Comment 31 delaye 2012-06-27 15:30:15 UTC
FSK|PEGI|Age

and

0
Comment 32 Marc Véron 2012-06-28 06:08:18 UTC
Hmm, maybe a calculation issue with the birth date. What is the birthdate of the patron you tested with?
Comment 33 delaye 2012-06-28 10:35:08 UTC
birthdate of the borrower : 19/05/2001
Comment 34 Marc Véron 2012-06-28 10:56:15 UTC
Thanks again for testing.

I have to rebase to the current master, will try to get it done this evening.
Comment 35 delaye 2012-06-28 11:50:00 UTC
it's work!!!...
thank you!!
Comment 36 Marc Véron 2012-06-28 12:02:50 UTC
Merveilleux, un grand merci!
Marc
Comment 37 Marc Véron 2012-06-28 20:52:16 UTC Comment hidden (obsolete)
Comment 38 Mason James 2012-07-06 01:32:25 UTC Comment hidden (obsolete)
Comment 39 Mason James 2012-07-06 01:38:36 UTC
(In reply to comment #38)
> Created attachment 10650 [details] [review]
> [PATCH] BUG 7621 [ENH] Circulation: Match age restriction of title with
> borrower's age without using categories
> 
> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
> 
> New version implementing Paul's advice.
> See Wiki http://wiki.koha-community.org/wiki/Age_restrictiotion


Passing QA on this...

 - fixed SQL typo in updatedatabase.pl then rebased patch on 
     commit 'ce138ac96f3a5a729568f6d7db2e50ce3653b7bb'

 - patch passes 'perlcritic' and 'prove xt' tests
Comment 40 Mason James 2012-07-06 03:01:43 UTC Comment hidden (obsolete)
Comment 41 Mason James 2012-07-06 03:15:42 UTC Comment hidden (obsolete)
Comment 42 Mason James 2012-07-06 03:20:04 UTC
> Passing QA on this...
> 
>  - fixed SQL typo in updatedatabase.pl then rebased patch on 
>      commit 'ce138ac96f3a5a729568f6d7db2e50ce3653b7bb'
> 
>  - patch passes 'perlcritic' and 'prove xt' tests

QA comment...

  - i added 'agerestriction' columns in kohastructure.sql, for biblioitems and deletedbiblioitems tables

  - and added 'agerestriction' column for deletedbiblioitems in updatedatabase.pl


some little gotchas for adding new columns to a table in Koha ;)
Comment 43 Marc Véron 2012-07-06 07:03:35 UTC
Mason,

Thanks a lot for passing QA and fixing beginner's mistakes! 

Marc
Comment 44 Paul Poulain 2012-07-06 12:23:01 UTC
QA comments:
I can't make it work. Here is what I did:
 * put "Age" in the AgeRestrictionMarker syspref
 * set "AgeRestrictionOverride" to allow
 * update default framework to map 330$a with biblioitems.agerestriction field
 * create a biblio, with Age 99, with an item
 * check-out the item to a patron that is born 01/01/1980

=> checkout made without any warning. Am I missing something ?
(note i've checked that biblioitems.agerestriction contains "Age 99", it does.

QA question = shouldn't we update the MARC frameworks (in installer/data/mysql/<language>/marc_flavour/*.sql to connect agerestriction field to biblioitems ?

failing QA until I can make it work.
Comment 45 delaye 2012-07-12 07:26:17 UTC
I try again the patch test in a sandbox but I have this error message

Applying: BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging C4/Circulation.pm
Auto-merging installer/data/mysql/kohastructure.sql
Auto-merging installer/data/mysql/sysprefs.sql
CONFLICT (content): Merge conflict in installer/data/mysql/sysprefs.sql
Auto-merging installer/data/mysql/updatedatabase.pl
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Failed to merge in the changes.
Patch failed at 0001 BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
Bug 7621 - Circulation: Match age restriction of title with borrower's age without using categories

BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
Apply? [yn]
Patch left in /tmp/BUG-7621-ENH-Circulation-Match-age-restriction-of--YuivIy.patch


****
I launch the following commands
ALTER TABLE biblioitems ADD COLUMN agerestriction VARCHAR(255) DEFAULT NULL AFTER cn_sort;



ALTER TABLE deletedbiblioitems ADD COLUMN agerestriction VARCHAR(255) DEFAULT NULL AFTER cn_sort;


INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionMarker','','Markers for age restriction indication, e.g. FSK|PEGI|Age|. See: http://wiki.koha-community.org/wiki/Age_restriction',NULL,'free');


 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionOverride',0,'Allow staff to check out an item with age restriction.',NULL,'YesNo');

but i have always the problem , in koha i don't find the new system preference

can you rebase the patch?....
Comment 46 Marc Véron 2012-07-15 08:07:48 UTC Comment hidden (obsolete)
Comment 47 Marc Véron 2012-07-15 08:10:44 UTC
Typo in wiki link above, correct link is:
http://wiki.koha-community.org/wiki/Age_restriction
Comment 48 Marc Véron 2012-07-15 08:20:12 UTC
Comment on attachment 10859 [details] [review]
BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories

Hmm, seems that I forgot to commit changes. New patch follows.
Comment 49 Mason James 2012-07-16 03:46:07 UTC
> 
> REBASED to Koha version: 3.09.00.025
> Comparision part changed in C4/Circulation.pm

Marc, can you provide a git-commit string, rather than the koha-version
Comment 50 Marc Véron 2012-07-16 05:23:22 UTC Comment hidden (obsolete)
Comment 51 Paul Poulain 2012-07-16 16:36:35 UTC
Ha ! I understang now why I couldn't make it work ! I needed almost 2 hours to understand !!!

Try "Age" in the syspref, and enter Age 18 => epic fail
In the code, the comparison line says:
            if (grep {uc($_) eq $value} @marker) {
UC ! UC ! UC !
Try AGE, it works !
So, either fix the patch or fix the documentation

2 other reasons for failing QA:
  * You patch says:
+                my $td = Date_to_Days(Today);
+                my $ad = Date_to_Days(@alloweddate);
+
+                if ( Date_to_Days(Today) <  Date_to_Days(@alloweddate) -1  ) {

 => you make no use of $td and $ad

 * The patch also says: preference('AgeRestrictionOverride ')
 => the space at the end of the syspref is bad
Comment 52 Marc Véron 2012-07-16 17:01:48 UTC
Paul,

Thank you very much for testing and for your findings. I'm really sorry that I wasted your time with a basic Perl error. I'm coming from C++ and PHP and I'm not yet very used to Perl.

Yesterday morning, I re-wrote the comparision part using a double for... loop to make the comparision code more readable, and it works now with "Age" (Upper-lower-case). But I could not manage to upload the new patch because git was down. 

I will try to get a new patch done this week if I find some time and a stable internet connection as well (still on vacation).

Marc
Comment 53 Paul Poulain 2012-07-17 08:50:33 UTC
(In reply to comment #52)
> Paul,
> 
> Thank you very much for testing and for your findings. I'm really sorry that
> I wasted your time with a basic Perl error. 
Don't worry for that, it's in my job ;-)

> Yesterday morning, I re-wrote the comparision part using a double for...
> loop to make the comparision code more readable, and it works now with "Age"
> (Upper-lower-case). But I could not manage to upload the new patch because
> git was down. 
making it case agnostic is a good idea I think.

So comparing uc($_) eq uc($value) is probably a good idea imo
Comment 54 Marc Véron 2012-07-17 14:16:35 UTC Comment hidden (obsolete)
Comment 55 Marc Véron 2012-07-17 14:24:12 UTC
Finally managed to upload patch (I have a very bad internet connection at the moment).
Comment 56 Mason James 2012-07-18 00:40:23 UTC
Marc's latest patch needs a sign-off here...
Comment 57 Jonathan Druart 2012-07-25 13:21:04 UTC Comment hidden (obsolete)
Comment 58 Marc Véron 2012-08-11 09:44:41 UTC Comment hidden (obsolete)
Comment 59 Marc Balmer 2012-08-15 15:05:55 UTC
(Mit Bezug zu comment 58)
> Anhang 11550 angelegt (attachment 11550 [details] [review])
> [SIGNED-OFF] BUG 7621 [ENH] Circulation: Match age restriction of title with
> borrower's age without using categories
> 
> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
> 
> New version implementing Paul's advice.
> See Wiki http://wiki.koha-community.org/wiki/Age_restrictiotion
> 
> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
> fix updatedatabase.pl
> 
> New fix updatedatabase.pl to apply to current master by Marc Veron
> veron@veron.ch

The wiki page is actually at http://wiki.koha-community.org/wiki/Age_restriction
Comment 60 Marc Véron 2012-09-02 17:23:14 UTC Comment hidden (obsolete)
Comment 61 Marc Véron 2012-09-02 17:41:38 UTC Comment hidden (obsolete)
Comment 62 Mason James 2012-09-03 12:38:48 UTC
(In reply to comment #61)
> Created attachment 11939 [details] [review]
> BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's
> age without using categories
> 
> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

looks good, passing QA...

$ koha-qa.pl 

testing 1 commit(s) (applied to commit 52973fc)
 * b67201f BUG 7621 [ENH] Circulation: Match age restriction of title with borrower's age without using categories
      C4/Biblio.pm
      C4/Circulation.pm
      installer/data/mysql/kohastructure.sql
      installer/data/mysql/sysprefs.sql
      installer/data/mysql/updatedatabase.pl
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt

- perlcritic-progressive tests...                 OK
- perl -c syntax tests...                         OK
- xt/tt_valid.t tests...                          OK
- xt/author/valid-template.t tests...             OK
- t/00-valid-xml.t tests...                       OK
Comment 63 Paul Poulain 2012-09-05 12:33:32 UTC
Patch pushed, well done everyone !!!
Comment 64 Jonathan Druart 2012-09-11 13:15:59 UTC Comment hidden (obsolete)
Comment 65 Marc Véron 2012-09-11 13:59:55 UTC Comment hidden (obsolete)
Comment 66 Marc Véron 2012-09-11 14:01:37 UTC
Thanks for the follow up, Jonathan.

Marc
Comment 67 Jonathan Druart 2012-09-12 13:35:48 UTC
Comment on attachment 12133 [details] [review]
[SIGNED-OFF] Bug 7621: Followup: FIX warnings "Scalar value @values[$take] better written as $values[$take]"

Fix with Bug 8761
Comment 68 Jonathan Druart 2012-09-12 13:36:40 UTC
adapting status
Comment 69 Marc Véron 2012-09-27 09:46:35 UTC
Created attachment 12547 [details]
Screenshots regarding usage

PDF added to show how to use the Age restriction feature (on request of http://irc.koha-community.org/irclog/koha/2012-09-26#i_1088535)
Comment 70 Nicole C. Engard 2012-09-27 14:26:35 UTC Comment hidden (obsolete)
Comment 71 Nicole C. Engard 2012-09-27 14:27:19 UTC
Follow up needs sign off. Original is already in master.
Comment 72 Nicole C. Engard 2012-09-27 14:30:25 UTC Comment hidden (obsolete)
Comment 73 Nicole C. Engard 2012-09-27 14:31:00 UTC
My last patch had typos.
Comment 74 Marc Véron 2012-09-27 15:29:57 UTC
Created attachment 12563 [details] [review]
[SIGNED-OFF] Bug 7621: Follow up to clarify preference language

This patch changes strings only, not functionality. It will
clarify the meaning of the  AgeRestrictionMarker preference.

Signed-off-by: Marc Veron <veron@veron.ch>

Better wording of preference instructions. No code echange involved.
Comment 75 Mason James 2012-10-03 00:27:55 UTC
(In reply to comment #74)
> Created attachment 12563 [details] [review]
> [SIGNED-OFF] Bug 7621: Follow up to clarify preference language
> 
> This patch changes strings only, not functionality. It will
> clarify the meaning of the  AgeRestrictionMarker preference.
> 
> Signed-off-by: Marc Veron <veron@veron.ch>
> 
> Better wording of preference instructions. No code echange involved.


passing QA, trivial patch
Comment 76 Paul Poulain 2012-10-05 09:58:40 UTC
follow-up [SIGNED-OFF] Bug 7621: Follow up to clarify preference language pushed