[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2025-01-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Jonathan Druart  changed:

   What|Removed |Added

 CC||jonathan.dru...@gmail.com

--- Comment #38 from Jonathan Druart  ---
This is nice but could be confusing. I would prefer an explicit way to retrieve
the extended attributes.

patron.get_extended_attribute("attribute")
patron.extended_attributes.get("attribute")
patron.extended_attributes["attribute"]

I don't think adding (black) magic for people writing template notices is a
good idea.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-19 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

   Keywords|roadmap_24_05,  |
   |roadmap_25_05   |

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-08 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #37 from Martin Renvoize (ashimema) 
 ---
(In reply to Tomás Cohen Arazi (tcohen) from comment #36)
> Have you discussed adding a prefix to those accessors for safety? Something
> like `attr_$code`, for example.

For ILL that's exactly what we did.. but you also won't hit the attribute
accessor here if you clash with an existing patron field name.  Honestly, I
wasn't sure which way to jump, but the basic code only felt nicer looking to me
for end users.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-06 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Tomás Cohen Arazi (tcohen)  changed:

   What|Removed |Added

 CC||tomasco...@gmail.com

--- Comment #36 from Tomás Cohen Arazi (tcohen)  ---
Have you discussed adding a prefix to those accessors for safety? Something
like `attr_$code`, for example.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-04 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

   Keywords||roadmap_24_05,
   ||roadmap_24_11,
   ||roadmap_25_05

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-04 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

 Attachment #173902|0   |1
is obsolete||

--- Comment #34 from Martin Renvoize (ashimema) 
 ---
Created attachment 173913
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173913&action=edit
Bug 30657: Try parent method first

This patch adds a try/catch inside the Koha::Patron AUTOLOAD to try and
find the method on the parent, including it's AUTOLOAD, prior to running
the local AUTOLOAD code to generate attribute accessors and then use the
called method.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-04 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #35 from Martin Renvoize (ashimema) 
 ---
Created attachment 173914
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173914&action=edit
Bug 30657: Further unit tests

Test the repeatable handling and error rethrow.  There's also an attempt
at counting calls to the database for subsequent attribute accessors,
but it fails in an odd way I'm struggling to understand, so that test is
commented for now

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-04 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

 Attachment #173901|0   |1
is obsolete||

--- Comment #33 from Martin Renvoize (ashimema) 
 ---
Created attachment 173912
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173912&action=edit
Bug 30657: Move to AUTOLOAD

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-04 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

 Attachment #173817|0   |1
is obsolete||

--- Comment #31 from Martin Renvoize (ashimema) 
 ---
Created attachment 173910
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173910&action=edit
Bug 30657: Unit tests

This patch adds some basic unit tests for dynamically added accessors
based on extended patron attributes.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-04 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

 Attachment #173818|0   |1
is obsolete||

--- Comment #32 from Martin Renvoize (ashimema) 
 ---
Created attachment 173911
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173911&action=edit
Bug 30657: Dynamically add attribute accessors

This patch adds dynamic creation of accessors for extended patron
attributes based on attribute code.

It should work for Koha::Patron objects resulting from calls to
Koha::Patron->new(), Koha::Patrons->search, Koha::Patrons->find and any
relations that return a Koha::Patron object.

We return a single value for non-repeatable attributes and an arrayref
of values for repeatable ones.

This should make it simple to access such attributes in Koha Notice
Templates.

Simply use the 'code' in your variables.. example:

You've added a 'smartcard' extended attribute to your system, you would
refer to it in your notice as [% patron.smartcard | html %]

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-04 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #30 from Martin Renvoize (ashimema) 
 ---
Created attachment 173902
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173902&action=edit
Bug 30657: Try parent method first

This patch adds a try/catch inside the Koha::Patron AUTOLOAD to try and
find the method on the parent, including it's AUTOLOAD, prior to running
the local AUTOLOAD code to generate attribute accessors and then use the
called method.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-03 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #29 from Martin Renvoize (ashimema) 
 ---
So, whilst this still works as an AUTOLOAD I think the code is very slightly
less clear and because we actually autoload so much from the parent (include
ALL the object field accessors) we don't actually save the DB call we were
aiming to save at all..  We could possibly try running the parent AUTOLOAD
prior to the child AUTOLOAD from within the child to negate this.. but I
couldn't get that to pass the tests consistently yet.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-11-03 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

 Attachment #173819|0   |1
is obsolete||

--- Comment #28 from Martin Renvoize (ashimema) 
 ---
Created attachment 173901
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173901&action=edit
Bug 30657: Move to AUTOLOAD

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-10-31 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

 Attachment #169057|0   |1
is obsolete||

--- Comment #26 from Martin Renvoize (ashimema) 
 ---
Created attachment 173818
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173818&action=edit
Bug 30657: Dynamically add attribute accessors

This patch adds dynamic creation of accessors for extended patron
attributes based on attribute code.

It should work for Koha::Patron objects resulting from calls to
Koha::Patron->new(), Koha::Patrons->search, Koha::Patrons->find and any
relations that return a Koha::Patron object.

We return a single value for non-repeatable attributes and an arrayref
of values for repeatable ones.

This should make it simple to access such attributes in Koha Notice
Templates.

Simply use the 'code' in your variables.. example:

You've added a 'smartcard' extended attribute to your system, you would
refer to it in your notice as [% patron.smartcard | html %]

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-10-31 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #27 from Martin Renvoize (ashimema) 
 ---
Created attachment 173819
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173819&action=edit
Bug 30657: Move to AUTOLOAD

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-10-31 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize (ashimema)  changed:

   What|Removed |Added

 Attachment #169056|0   |1
is obsolete||

--- Comment #25 from Martin Renvoize (ashimema) 
 ---
Created attachment 173817
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173817&action=edit
Bug 30657: Unit tests

This patch adds some basic unit tests for dynamically added accessors
based on extended patron attributes.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-10-31 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #24 from Martin Renvoize (ashimema) 
 ---
(In reply to Ray Delahunty from comment #23)
> (In reply to Martin Renvoize (ashimema) from comment #18)
> > We're really inconsistent in our notice variables unfortunately.. sometimes
> > it's borrower, sometimes it's patron 
> > 
> > [...] encourage end users to understand the relationships
> > between things to be able to lookup the information they need via object
> > traversal.
> 
> Am I off on a tangent here? This may be one of the reasons we librarians
> trying to use template toolkit to tidy up our notices struggle with TT. The
> table is borrowers in Koha but in template toolkit it is borrower. I'm
> gradually knowing what to use (not that I know why). Is there something like
> a schema for TT (probably a silly question), or can the TT variables
> (accessors??) gradually replace the alligator code on the left hand side of
> the notice design interface?

Unfortunately Ray it's not quite as simple as that :(.

There's lots of history here.. and some technical challenges too.

Notices are all generated by called to a method called 'GetPreparedLetter'..
that method is passed the template (which you define in your notices) and a
"bunch of variables" the template can use.  The challenge comes in identifying
which variables are likely to get passed into the call to GetPreparedLetter so
you can use them in your template.. it's a bit of a 'chicken and the egg'
problem.. before we call the method we can't know what's in there.. but we
can't call the method until we have a template to pass it.. but how does the
person building the template know what variables that can use to build their
template?

I've been wanting for a long time to work on cleaning up our notice generation
and write such a schema so the notice editor can definitely know what variables
it's getting passed for each notice type and you can therefore build notices
with more knowledge. (right now the <<>> helpers are a 'best guess' and often
get it wrong).

Back to this bug.. the aim here is to make extended patron attributes more
accessible for any notice that pass passed a patron object.. said patron
objects might be exposed with various variable names.. most often 'borrower'..
but I've also seen 'librarian', 'patron', 'user', 'author' etc etc in use... we
need that schema writing and maintaining in the future.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-10-13 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Ray Delahunty  changed:

   What|Removed |Added

 CC||r.delahu...@arts.ac.uk

--- Comment #23 from Ray Delahunty  ---
(In reply to Martin Renvoize (ashimema) from comment #18)
> We're really inconsistent in our notice variables unfortunately.. sometimes
> it's borrower, sometimes it's patron 
> 
> [...] encourage end users to understand the relationships
> between things to be able to lookup the information they need via object
> traversal.

Am I off on a tangent here? This may be one of the reasons we librarians trying
to use template toolkit to tidy up our notices struggle with TT. The table is
borrowers in Koha but in template toolkit it is borrower. I'm gradually knowing
what to use (not that I know why). Is there something like a schema for TT
(probably a silly question), or can the TT variables (accessors??) gradually
replace the alligator code on the left hand side of the notice design
interface?

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-10-08 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #22 from Martin Renvoize (ashimema) 
 ---
Well.. I did actually have some code that does it in an autoload.. we stripped
it from another submission recently.. I'll dig it out

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-23 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #21 from Emily Lamancusa  
---
I really like the new accessors added in this patch! I do think there's a lot
of value in making it more intuitive to access extended attributes in notice
templates, since that can be a big usability improvement.

The performance question is worth considering... If I'm correct in thinking
that Koha::Patron::Attribute::Types->search(); will add an extra database call
each time a patron object is created, I could see how that may add up when a
script creates a large number of patron objects. Can we work the same basic
logic into an AUTOLOAD instead, so that it won't run unless it's actually
needed?

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-17 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #20 from David Cook  ---
I'm going to be away the next few days, but I'll take a look at this next week

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #19 from Martin Renvoize  ---
What are people's general opinion on the accessors proposed here?

With this patch we add accessors per attribute code.

For non-repatable it's as simple as:
[% borrower.attribute_code %]

Whilst for repeatable we have:
[% FOR attribute IN borrower.attribute_code %]
[% attribute %]
[% END %]

This adds a bit of code complexity and possibly has some effect on performance
whilst we do already offer some alternatives.

For non-repeatable we already support:
[% attribute = borrower.get_extended_attribute(attribute_code) %]
[% attribute.description %]

For repeatable we have
[% FOREACH ba IN borrower.extended_attributes %]
 [% IF ba.code == 'UNCLE' %]
  [% alt_id = ba.attribute %]
 [% END %]
[% END %]

Is the extra code I introduce here to simplify for the end user worth it's
weight?

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize  changed:

   What|Removed |Added

 Blocks||36270


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36270
[Bug 36270] Remove special handling for <>
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #18 from Martin Renvoize  ---
We're really inconsistent in our notice varaibles unfortunately.. sometimes
it's borrower, sometimes it's patron and other times it's more descriptive like
'owner' or 'librarian'.

I'd really like to try and use the more prescriptive variable names long term
and in my preference, I'd rather see fewer top-level variables available and
instead encourage end users to understand the relationships between things to
be able to lookup the information they need via object traversal.  In reality,
we need to really improve the editor to help with that.

Thanks for testing.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #17 from Brendan Lawlor  ---
Test notes:

This worked but I found the name of the object was borrower instead of patron:
[% borrower.party_mode | html %]

The test Patron.t passed everything, but the qa script returned one failure:
 FAIL   Koha/Patron.pm
   FAIL   critic
# TestingAndDebugging::ProhibitNoStrict: Got 1 violation(s).

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Brendan Lawlor  changed:

   What|Removed |Added

 Attachment #169050|0   |1
is obsolete||

--- Comment #16 from Brendan Lawlor  ---
Created attachment 169057
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=169057&action=edit
Bug 30657: Dynamically add attribute accessors

This patch adds dynamic creation of accessors for extended patron
attributes based on attribute code.

It should work for Koha::Patron objects resulting from calls to
Koha::Patron->new(), Koha::Patrons->search, Koha::Patrons->find and any
relations that return a Koha::Patron object.

We return a single value for non-repeatable attributes and an arrayref
of values for repeatable ones.

This should make it simple to access such attributes in Koha Notice
Templates.

Simply use the 'code' in your variables.. example:

You've added a 'smartcard' extended attribute to your system, you would
refer to it in your notice as [% patron.smartcard | html %]

Signed-off-by: Brendan Lawlor 

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Brendan Lawlor  changed:

   What|Removed |Added

 Attachment #169049|0   |1
is obsolete||

--- Comment #15 from Brendan Lawlor  ---
Created attachment 169056
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=169056&action=edit
Bug 30657: Unit tests

This patch adds some basic unit tests for dynamically added accessors
based on extended patron attributes.

Signed-off-by: Brendan Lawlor 

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Brendan Lawlor  changed:

   What|Removed |Added

 Status|Needs Signoff   |Signed Off

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

--- Comment #14 from Kyle M Hall  ---
Bug 20443 adds Koha::Patron::get_extended_attribute_value which works for
non-repeatable attributes fwiw.

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Kyle M Hall  changed:

   What|Removed |Added

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

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize  changed:

   What|Removed |Added

 CC||katrin.fisc...@bsz-bw.de

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


[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in notices

2024-07-16 Thread bugzilla-daemon--- via Koha-bugs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657

Martin Renvoize  changed:

   What|Removed |Added

Summary|Make patron attributes  |Make patron attributes
   |available via Template  |available via Template
   |Toolkit in overdues |Toolkit in notices

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