Since the change to accommodate multiple guarantees per borrower, it is impossible to get the garantor's information in notices. It is customary here to send things to the parent as C/O (care of), especially if it's by the mail. I was wondering if it was possible to make the guarantor information available in notices. Thanks!
Created attachment 130339 [details] [review] Bug 28556: Guarantor's information is available in notice This patch adds the guarantor's information when sending sending overdue notice. To test: 1. Make sure that there is an overdue letter. a) Go in Tools/Notices & Slips. b) Search for the code "ODUE" and note the "Name" of the letter. c) Click on "Edit". d) Click on "Email" and make sure that there is text inside the box. e) Add the following code in the textbox: C/O <<guarantor.firstname>> <<guarantor.surname>> <br/> f) Click on "Save". 2. Set up the status trigger. a) Go in Tools/Overdue notice/status triggers. b) In "First" tab, put a number of days in the "Delay" column (ex: 1). c) In the column "Letter", put the "Name" of the letter of step 1a) . d) Check "Email". e) Click "Save". 3. Create a patron with a guarantor. a) Go in Administration/Patron categories. b) Create a child category AND a adult category. c) Create an adult patron. d) Create a child patron. e) Go in the child patron's page and click "Edit". f) In the "Patron guarantor" section, click add guarantor. g) Search for your adult patron and click "Select". h) Select a relationship for the guarantor (ex: Mother). i) Click on "Save". 4. Borrow an overdue item. a) Click on the arrow next to "Search button" (Top of the screen). b) Click on "Items search". c) Click on search. d) Copy a barcode in the list. e) Search for your child patron. f) Go in his page and click on "Checkout". g) Paste the barcode copied at step 4d) . h) Click on "Checkout settings". i) Put a date in the past greater than the number of days that you put on step 2b). j) Click on "Check out". k) Click on "Yes" Notice tht there is a message saying that Patron has ITEMS OVERDUE. 5. Test the patch. a) In the terminal, run ./misc/cronjobs/overdue_notices.pl b) Return in your child patron's page. c) Click on "Notice" and you should see a letter. d) Click on the letter to see the content. c) Notice that you can't see the guarantor's informations (Adult patron). d) Apply the patch. e) Notice that you can see the guarantor's informations. NOTE: If you want to delete the letters, do in your terminal: - my - delete from message_queue;
Created attachment 130340 [details] [review] Bug 28556: Guarantor's information is available in notice This patch adds the guarantor's information when sending sending overdue notice. To test: 1. Make sure that there is an overdue letter. a) Go in Tools/Notices & Slips. b) Search for the code "ODUE" and note the "Name" of the letter. c) Click on "Edit". d) Click on "Email" and make sure that there is text inside the box. e) Add the following code in the textbox: C/O <<guarantor.firstname>> <<guarantor.surname>> <br/> f) Click on "Save". 2. Set up the status trigger. a) Go in Tools/Overdue notice/status triggers. b) In "First" tab, put a number of days in the "Delay" column (ex: 1). c) In the column "Letter", put the "Name" of the letter of step 1a) . d) Check "Email". e) Click "Save". 3. Create a patron with a guarantor. a) Go in Administration/Patron categories. b) Create a child category AND a adult category. c) Create an adult patron. d) Create a child patron. e) Go in the child patron's page and click "Edit". f) In the "Patron guarantor" section, click add guarantor. g) Search for your adult patron and click "Select". h) Select a relationship for the guarantor (ex: Mother). i) Click on "Save". 4. Borrow an overdue item. a) Click on the arrow next to "Search button" (Top of the screen). b) Click on "Items search". c) Click on search. d) Copy a barcode in the list. e) Search for your child patron. f) Go in his page and click on "Checkout". g) Paste the barcode copied at step 4d) . h) Click on "Checkout settings". i) Put a date in the past greater than the number of days that you put on step 2b). j) Click on "Check out". k) Click on "Yes" Notice tht there is a message saying that Patron has ITEMS OVERDUE. 5. Test the patch. a) In the terminal, run ./misc/cronjobs/overdue_notices.pl b) Return in your child patron's page. c) Click on "Notice" and you should see a letter. d) Click on the letter to see the content. c) Notice that you can't see the guarantor's informations (Adult patron). d) Apply the patch. e) Reapeat steps a) to d) f) Notice that you can see the guarantor's informations. NOTE: If you want to delete the letters, do in your terminal: - my - delete from message_queue;
When I set my guarantor as a Non-patron guarantor and run the overdue_notices cron the job fails and I get this error: Can't call method "unblessed" on an undefined value at /kohadevbox/koha/C4/Letters.pm line 652
Created attachment 135214 [details] [review] Bug 28556: Guarantor's information is available in notice This patch adds the guarantor's information when sending overdue notice. To test: 1. Make sure that there is an overdue letter. a) Go in Tools/Notices & Slips. b) Search for the code "ODUE" and note the "Name" of the letter. c) Click on "Edit". d) Click on "Email" and make sure that there is text inside the box. e) Add the following code in the textbox: C/O <<guarantor.firstname>> <<guarantor.surname>> <br/> f) Click on "Save". 2. Set up the status trigger. a) Go in Tools/Overdue notice/status triggers. b) In "First" tab, put a number of days in the "Delay" column (ex: 1). c) In the column "Letter", put the "Name" of the letter of step 1a) . d) Check "Email". e) Click "Save". 3. Create a patron with a guarantor. a) Go in Administration/Patron categories. b) Create a child category AND a adult category. c) Create an adult patron. d) Create a child patron. e) Go in the child patron's page and click "Edit". f) In the "Patron guarantor" section, click add guarantor. g) Search for your adult patron and click "Select". h) Select a relationship for the guarantor (ex: Mother). i) Click on "Save". 4. Borrow an overdue item. a) Click on the arrow next to "Search button" (Top of the screen). b) Click on "Items search". c) Click on search. d) Copy a barcode in the list. e) Search for your child patron. f) Go in his page and click on "Checkout". g) Paste the barcode copied at step 4d) . h) Click on "Checkout settings". i) Put a date in the past greater than the number of days that you put on step 2b). j) Click on "Check out". k) Click on "Yes" Notice tht there is a message saying that Patron has ITEMS OVERDUE. 5. Test the patch. a) In the terminal, run ./misc/cronjobs/overdue_notices.pl b) Return in your child patron's page. c) Click on "Notice" and you should see a letter. d) Click on the letter to see the content. c) Notice that you can't see the guarantor's informations (Adult patron). d) Apply the patch. e) Repeat steps a) to d) f) Notice that you can see the guarantor's informations. This also works if you decide to add a non-patron guarantor instead of a patron guarantor at step 3. NOTE: If you want to delete the letters, go in your database and run: - delete from message_queue;
I think there will need to be updated unit tests here. If I apply the patch and run 'prove -v t/db_dependent/Letters.t' the tests fail: Can't call method "guarantor_relationships" on an undefined value at /kohadevbox/koha/C4/Letters.pm line 651.
Created attachment 146397 [details] [review] Bug 28556: Guarantor's information is available in notice This patch adds the guarantor's information when sending overdue notice. To test: 1. Make sure that there is an overdue letter. a) Go in Tools/Notices & Slips. b) Search for the code "ODUE" and note the "Name" of the letter. c) Click on "Edit". d) Click on "Email" and make sure that there is text inside the box. e) Add the following code in the textbox: C/O <<guarantor.firstname>> <<guarantor.surname>> <br/> Or add another guarantor. in the textbox from the select list. f) Click on "Save". 2. Set up the status trigger. a) Go in Tools/Overdue notice/status triggers. b) In "First" tab, put a number of days in the "Delay" column (ex: 1). c) In the column "Letter", put the "Name" of the letter of step 1a) . d) Check "Email". e) Click "Save". 3. Create a patron with a guarantor. a) Go in Administration/Patron categories. b) Create a child category AND a adult category. c) Create an adult patron. d) Create a child patron. e) Go in the child patron's page and click "Edit". f) In the "Patron guarantor" section, click add guarantor. g) Search for your adult patron and click "Select". h) Select a relationship for the guarantor (ex: Mother). i) Click on "Save". 4. Borrow an overdue item. a) Click on the arrow next to "Search button" (Top of the screen). b) Click on "Items search". c) Click on search. d) Copy a barcode in the list. e) Search for your child patron. f) Go in his page and click on "Checkout". g) Paste the barcode copied at step 4d) . h) Click on "Checkout settings". i) Put a date in the past greater than the number of days that you put on step 2b). j) Click on "Check out". k) Click on "Yes" Notice tht there is a message saying that Patron has ITEMS OVERDUE. 5. Test the patch. a) In the terminal, run ./misc/cronjobs/overdue_notices.pl b) Return in your child patron's page. c) Click on "Notice" and you should see a letter. d) Click on the letter to see the content. c) Notice that you can't see the guarantor's informations (Adult patron). d) Apply the patch. e) Repeat steps a) to d) f) Notice that you can see the guarantor's informations. This also works if you decide to add a non-patron guarantor instead of a patron guarantor at step 3. NOTE: If you want to delete the letters, go in your database and run: - delete from message_queue; Signed-off-by: Marius Mandrescu <marius.mandrescu@inLibro.com> Current patch-complexity: Small patch
Created attachment 146398 [details] [review] Bug 28556: Guarantor's information is available in notice This patch adds the guarantor's information when sending overdue notice. To test: 1. Make sure that there is an overdue letter. a) Go in Tools/Notices & Slips. b) Search for the code "ODUE" and note the "Name" of the letter. c) Click on "Edit". d) Click on "Email" and make sure that there is text inside the box. e) Add the following code in the textbox: C/O <<guarantor.firstname>> <<guarantor.surname>> <br/> Or add another guarantor. in the textbox from the select list. f) Click on "Save". 2. Set up the status trigger. a) Go in Tools/Overdue notice/status triggers. b) In "First" tab, put a number of days in the "Delay" column (ex: 1). c) In the column "Letter", put the "Name" of the letter of step 1a) . d) Check "Email". e) Click "Save". 3. Create a patron with a guarantor. a) Go in Administration/Patron categories. b) Create a child category AND a adult category. c) Create an adult patron. d) Create a child patron. e) Go in the child patron's page and click "Edit". f) In the "Patron guarantor" section, click add guarantor. g) Search for your adult patron and click "Select". h) Select a relationship for the guarantor (ex: Mother). i) Click on "Save". 4. Borrow an overdue item. a) Click on the arrow next to "Search button" (Top of the screen). b) Click on "Items search". c) Click on search. d) Copy a barcode in the list. e) Search for your child patron. f) Go in his page and click on "Checkout". g) Paste the barcode copied at step 4d) . h) Click on "Checkout settings". i) Put a date in the past greater than the number of days that you put on step 2b). j) Click on "Check out". k) Click on "Yes" Notice tht there is a message saying that Patron has ITEMS OVERDUE. 5. Test the patch. a) In the terminal, run ./misc/cronjobs/overdue_notices.pl b) Return in your child patron's page. c) Click on "Notice" and you should see a letter. d) Click on the letter to see the content. c) Notice that you can't see the guarantor's informations (Adult patron). d) Apply the patch. e) Repeat steps a) to d) f) Notice that you can see the guarantor's informations. This also works if you decide to add a non-patron guarantor instead of a patron guarantor at step 3. NOTE: If you want to delete the letters, go in your database and run: - delete from message_queue; Signed-off-by: Marius Mandrescu <marius.mandrescu@inLibro.com> Current patch-complexity: Small patch
You realise you can already use ALL object methods in TT based notices right? So anywhere you have a patron in a notice you can use the relations to get at the guarantors. I'm not sure we need to add the boiler code here to support this.. we're trying to clean up these scripts and then simplify/clarify the pickers in the medium to long term.
[% FOREACH guarantor_relation IN patron.guarantor_relatuonships %] [% SET guarantor = guarantor_relation.guarantor %] [% guarantor.firstname | html %] [% END %]
Improving the notice creation tools and migrating all notices to TT so we can deprecate the older custom syntaxes was on the roadmaps for at least three cycles, but it's not a one person job and didn't get the uptake from people... I'd rather see effort shared and pushed in that direction that adding more old style code and hacks on top like this I'm afraid. This gets a downvote from me.
After testing I can confirm that Martin is correct, this is alreay doable. Have a look these 2 subroutines in Patron.pm to see how: sub guarantor_relationships sub guarantee_relationships and if you want to get fines for guarantors or guarantees see: sub relationships_debt I am marking this one as RESOLVED = WORKSFORME