Bug 12446 - Enable an adult to have a guarantor
Summary: Enable an adult to have a guarantor
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature (vote)
Assignee: Charles Farmer
QA Contact: Testopia
URL:
Keywords: rel_20_05_target
: 6922 9305 (view as bug list)
Depends on: 17168 14570
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-18 15:01 UTC by simith.doliveira
Modified: 2019-11-13 21:11 UTC (History)
27 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12446 - Enable an adult to have a guarantor (19.91 KB, patch)
2014-06-26 13:38 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (19.89 KB, patch)
2015-02-26 14:37 UTC, Jonathan Druart
Details | Diff | Splinter Review
bug 12446 - Enable adult patrons to have a guarantor (28.14 KB, patch)
2015-06-01 13:44 UTC, Maxime Beaulieu
Details | Diff | Splinter Review
bug 12446 - Enable adult patrons to have a guarantor (28.44 KB, patch)
2015-09-09 19:50 UTC, Genevieve Plantin
Details | Diff | Splinter Review
Bug 12446 - Clean code according to Comment 12 (4.55 KB, patch)
2015-09-09 19:51 UTC, Genevieve Plantin
Details | Diff | Splinter Review
Bug 12446 - Displayed button Add guarantee in Details section (1.06 KB, patch)
2015-09-14 19:17 UTC, Genevieve Plantin
Details | Diff | Splinter Review
bug 12446 - Enable adult patrons to have a guarantor (65.78 KB, patch)
2016-01-05 20:12 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
bug 12446 - Enable adult patrons to have a guarantor (65.57 KB, patch)
2016-01-05 20:17 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
bug 12446 - Enable adult patrons to have a guarantor (26.02 KB, patch)
2016-01-06 13:53 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
bug 12446 - Enable adult patrons to have a guarantor (27.40 KB, patch)
2016-01-06 14:27 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
bug 12446 - Enable adult patrons to have a guarantor (26.42 KB, patch)
2016-01-06 18:28 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
bug 12446 - Atomic update now sets canbeguarantee to 1 for categories of type C and P (1.14 KB, patch)
2016-01-11 14:38 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
Bug 12446 - Enable adult patrons to have a guarantor (27.51 KB, patch)
2016-04-01 14:32 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 12446 - Enable adult patrons to have a guarantor (26.83 KB, patch)
2016-04-28 20:41 UTC, Rémi Mayrand-Provencher
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (34.40 KB, patch)
2016-07-20 19:03 UTC, Mehdi Hamidi
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (34.40 KB, patch)
2016-07-20 19:06 UTC, Mehdi Hamidi
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (33.52 KB, patch)
2016-07-20 19:51 UTC, Mehdi Hamidi
Details | Diff | Splinter Review
Bug 12446 - QA Follow-up (7.61 KB, patch)
2016-08-02 14:41 UTC, Mehdi Hamidi
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (31.30 KB, patch)
2017-03-08 19:00 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (31.30 KB, patch)
2017-03-08 19:01 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (31.23 KB, patch)
2017-03-08 19:17 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Remove wrong importation in DataTables/Members.pm (2.59 KB, patch)
2017-05-04 19:16 UTC, Philippe Audet-Fortin
Details | Diff | Splinter Review
Remove wrong importation in DataTables/Members.pm (2.64 KB, patch)
2017-05-04 19:32 UTC, Philippe Audet-Fortin
Details | Diff | Splinter Review
ID change for jQuery listener (3.79 KB, patch)
2017-05-05 20:42 UTC, Philippe Audet-Fortin
Details | Diff | Splinter Review
Cam 722: Permet a n'importe quelle categorie d'avoir un garant (bz12446) (26.24 KB, patch)
2017-07-04 21:04 UTC, Philippe Audet-Fortin
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (30.39 KB, patch)
2017-07-04 21:18 UTC, Philippe Audet-Fortin
Details | Diff | Splinter Review
Bug 12446 - Added a missing comma in kohastructure.sql (1.50 KB, patch)
2017-07-05 19:54 UTC, Philippe Audet-Fortin
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (33.77 KB, patch)
2018-02-28 23:19 UTC, Roch D'Amour
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (33.82 KB, patch)
2018-03-14 15:30 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (34.72 KB, patch)
2018-08-13 20:40 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 12446: Enable an adult to have a guarantor (34.72 KB, patch)
2018-08-13 20:41 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (5.77 KB, patch)
2018-08-13 20:41 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (7.74 KB, patch)
2018-09-24 20:06 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (35.03 KB, patch)
2018-09-24 20:11 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (7.74 KB, patch)
2018-09-24 20:12 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446 - Enable an adult to have a guarantor (35.03 KB, patch)
2018-09-24 20:27 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (7.74 KB, patch)
2018-09-24 20:27 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page (878 bytes, patch)
2019-02-13 23:04 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: Enable an adult to have a guarantor (35.11 KB, patch)
2019-04-19 18:03 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (7.93 KB, patch)
2019-04-19 18:03 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page (878 bytes, patch)
2019-04-19 18:03 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) QA tests fixing, cleaning code (2.94 KB, patch)
2019-04-19 18:03 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 12446: Enable an adult to have a guarantor (37.16 KB, patch)
2019-06-06 19:00 UTC, Nadine Pierre
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (7.92 KB, patch)
2019-06-06 19:00 UTC, Nadine Pierre
Details | Diff | Splinter Review
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page (885 bytes, patch)
2019-06-06 19:00 UTC, Nadine Pierre
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) QA tests fixing, cleaning code (2.94 KB, patch)
2019-06-06 19:01 UTC, Nadine Pierre
Details | Diff | Splinter Review
Bug 12446: Enable an adult to have a guarantor (37.32 KB, patch)
2019-06-11 03:33 UTC, Hayley Mapley
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (8.03 KB, patch)
2019-06-11 03:33 UTC, Hayley Mapley
Details | Diff | Splinter Review
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page (946 bytes, patch)
2019-06-11 03:34 UTC, Hayley Mapley
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) QA tests fixing, cleaning code (3.02 KB, patch)
2019-06-11 03:34 UTC, Hayley Mapley
Details | Diff | Splinter Review
Bug 12446: Enable an adult to have a guarantor (25.97 KB, patch)
2019-10-01 20:02 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally (3.14 KB, patch)
2019-10-01 20:03 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page (939 bytes, patch)
2019-10-01 20:03 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: (QA follow-up) QA tests fixing, cleaning code (3.00 KB, patch)
2019-10-01 20:03 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: Schema update Category.pm (961 bytes, patch)
2019-10-01 20:03 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: (follow-up) Remove mandatory transfered values (8.07 KB, patch)
2019-10-01 20:03 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: (follow-up) Code cleaning (10.47 KB, patch)
2019-10-01 20:03 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 12446: (follow-up) Update for Bug 17168 (3.59 KB, patch)
2019-11-13 21:11 UTC, Maryse Simard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description simith.doliveira 2014-06-18 15:01:41 UTC
Our sponsor require an adjustment to allow an adult to have a guarantor and some other modifications concerning. This Fix:

- Enable an adult to have a guarantor;
- Shows guarantees fines in the guarantor's page;
- Transfer some guarantor's information to the guarantee while creating;
- Transfer guarantor's alternate contact to the guarantee while creating.  

Sponsor by: ville de victoriaville
Comment 1 simith.doliveira 2014-06-26 13:38:58 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2015-02-10 16:50:55 UTC
Patch does not apply:

CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
Comment 3 Jonathan Druart 2015-02-26 14:37:40 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-02-26 14:37:57 UTC
Easy conflict, fixed.
Comment 5 Nicole C. Engard 2015-03-02 14:44:16 UTC
While the code works, this is a problem for many libraries. I think this should be an on/off switch on the patron category administration page. That way some categories can have it and others won't.  If it's there for all patrons it will be requested that we hide it for all but children and that can't be done easily.

Nicole
Comment 6 Kyle M Hall 2015-03-04 15:12:28 UTC
I completely agree. This should be an optional feature implemented at the patron category level. Otherwise this makes an irreversible change to Koha. Many librarians complain that the patron form is too long already. We cannot hide this for adults without also hiding it for children, thus it must be implemented as an optional feature. The most sensible way to do this would be to add a switch at the patron category level that enables the ability to set a guarantor for a given patron type.

(In reply to Nicole C. Engard from comment #5)
> While the code works, this is a problem for many libraries. I think this
> should be an on/off switch on the patron category administration page. That
> way some categories can have it and others won't.  If it's there for all
> patrons it will be requested that we hide it for all but children and that
> can't be done easily.
> 
> Nicole
Comment 7 Francois Charbonnier 2015-03-04 15:25:28 UTC
Hi Nicole, Hi Kyle,

I do not agree since it fixes an issue in Koha.

Koha already allows librarian to linked adult cards together. But once the cards are linked together, if the guarantee is an adult, the patron edit page doesn't display the "Guarantor information". So you can't edit the link. If you want to, you have to change the patron category to a child type, edit it and then put back the correct patron category.

To me, it's a feature that needed to be fixed.

I agree there is a need to be able to hide parts of the patron edit page but I think it should be part of a different feature. If we add the ability to control the display of the edit patron page, we should be able to do it for every part of the page.

What do you think?
Comment 8 Nicole C. Engard 2015-03-04 15:59:26 UTC
Discussion from IRC: http://irc.koha-community.org/koha/2015-03-04#i_1645311
Comment 9 Francois Charbonnier 2015-03-04 16:16:41 UTC
Thanks nicole!
We just talked about this with Nicole and Kyle.
We agreeded on this :
* On the patron category page, there will be a new button : "display the edit garantor information box" : yes | no
* by default, we will have "yes" for child and professional categories
* if yes, we will display the edit guarantor box on the patron edit page
Comment 10 Maxime Beaulieu 2015-06-01 13:44:36 UTC Comment hidden (obsolete)
Comment 11 Marc Véron 2015-09-03 12:47:06 UTC
Wanted to test but patch does not apply.
Comment 12 M. Tompsett 2015-09-04 05:52:51 UTC
Comment on attachment 39744 [details] [review]
bug 12446 - Enable adult patrons to have a guarantor

Review of attachment 39744 [details] [review]:
-----------------------------------------------------------------

I just skimmed the patches. The linking guarantor to a specific category code is bad. I like the notion of a canbeguaranteed code field. Some code changes aren't obvious to me.

::: C4/Utils/DataTables/Members.pm
@@ +38,5 @@
> +        @columns = grep { ! $seen{ $_ }++ } ( @columns, @guarantor_attributes );
> +    };
> +    $_ = "borrowers.".$dbh->quote_identifier($_) for (@columns);
> +
> +    my $select = "SELECT ${ \join(',', @columns) },

This code is horrible to read!

::: installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql
@@ +9,5 @@
> +-- ********* --
> +ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0';
> +
> +-- Set defaults for new column
> +UPDATE categories set canbeguarantee = 1 WHERE category_type IN ('C', 'P');
\ No newline at end of file

Default behaviour should NOT activate new functionality.

::: installer/data/mysql/sysprefs.sql
@@ +481,4 @@
>  ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
>  ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
>  ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
> +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),

Why was , added at the end?

::: koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
@@ +148,4 @@
>  
>      [% IF ( CAN_user_borrowers ) %]
>          [% IF ( adultborrower AND activeBorrowerRelationship ) %]
> +            <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C"><i class="icon-plus"></i> Add guarantiee</a>

Is that spelt correctly?

::: koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
@@ +25,5 @@
>          $("#branches option:first").attr("selected", "selected");
>      }
> +    $("#category_type").change(function(){
> +        var selected = $(this).val();
> +        $("#canbeguarantee").val( (selected == 'C' || selected == 'P') ? "1" : "0" );

Hardcoded category codes is a bad thing.
Is there a better way to do this?

::: members/memberentry.pl
@@ +251,4 @@
>  }
>  
>    #recover all data from guarantor address phone ,fax... 
> +if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {

Why remove the space?

@@ -259,5 @@
>          if ( $op eq 'add' ) {
>  	        foreach (qw(streetnumber address streettype address2
> -                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
> -                        B_streetnumber B_streettype B_address B_address2
> -                        B_city B_state B_zipcode B_country B_email B_phone)) {

Why were these removed?

::: members/moremember.pl
@@ +204,2 @@
>  	if ($category_type eq 'C'){
>  		$template->param('C' => 1);

Is this used anymore in the template file? I saw you removed one C condition.
Comment 13 Genevieve Plantin 2015-09-09 19:50:48 UTC Comment hidden (obsolete)
Comment 14 Genevieve Plantin 2015-09-09 19:51:01 UTC Comment hidden (obsolete)
Comment 15 Genevieve Plantin 2015-09-14 19:17:05 UTC Comment hidden (obsolete)
Comment 16 Aleisha Amohia 2015-12-29 01:46:49 UTC
Applying: bug 12446 - Enable adult patrons to have a guarantor
/home/vagrant/kohaclone/.git/rebase-apply/patch:456: trailing whitespace.
#recover all data from guarantor address phone ,fax... 
/home/vagrant/kohaclone/.git/rebase-apply/patch:468: trailing whitespace.
                        B_city B_state B_zipcode B_country B_email B_phone)) {		        
fatal: sha1 information is lacking or useless (C4/Utils/DataTables/Members.pm).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 bug 12446 - Enable adult patrons to have a guarantor
Comment 17 Rémi Mayrand-Provencher 2016-01-05 20:12:03 UTC Comment hidden (obsolete)
Comment 18 Rémi Mayrand-Provencher 2016-01-05 20:17:51 UTC Comment hidden (obsolete)
Comment 19 Jonathan Druart 2016-01-06 12:33:37 UTC
Bug 15407 is going to remove C4::Category, you should use Koha::Patron::Categories instead.
Comment 20 Rémi Mayrand-Provencher 2016-01-06 13:53:14 UTC Comment hidden (obsolete)
Comment 21 Rémi Mayrand-Provencher 2016-01-06 13:59:16 UTC
Comment on attachment 46327 [details] [review]
bug 12446 - Enable adult patrons to have a guarantor

>From 7020394e74d993f645d8b1b7bf98649a00c1f837 Mon Sep 17 00:00:00 2001
>From: remi <remi.mayrand-provencher@inLibro.com>
>Date: Wed, 6 Jan 2016 08:46:27 -0500
>Subject: [PATCH] bug 12446 - Enable adult patrons to have a guarantor
>
>The C4::Category file was not even used! rebased to avoid eventual possible conflicts.
>
>I have rebased every patch.
>This includes all the features from the previous patches.
>
>On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
>The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".
>
>1) Apply the patch
>2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
>3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
>4) See below to test various scenarios
>
>- Enable an adult to have a guarantor:
>0.0) Create or edit a patron category of type 'A'.
>0.1) Set the "Can be guarantee" field to "Yes" and save.
>1) Select an adult patron -> details tab;
>2) Click edit button;
>3) validate "guarantor information" fieldset;
>
>- Shows guarantees' fines in the guarantor's page:
>4) Click Set to patron button and select a guarantor;
>5) Generate a fine;
>6) Select guarantor patron -> details tab;
>7) Validate guarantee's fine information.
>
>- Transfer some guarantor's information to the guarantee while adding a guarantiee:
>0) Select an adult patron;
>1) Insert all information;
>2) Click Add guarantiee bouton;
>3) Validade Garantor information/Main address/Contact fieldsets filled;
>
>- Transfer some guarantor's information to the guarantee while creating a new patron
>0) Select an adult patron;
>1) Insert all information;
>2) Add a new adult patron;
>3) Click "Set to patron" button;
>4) Select the adult patron from 0);
>5) Validade Garantor information/Main address/Contact fieldsets filled;
>
>- Transfer some guarantor's information to the guarantee while adding a guarantiee:
>0) Select an adult patron;
>1) Insert all information;
>2) Click Add guarantiee bouton;
>3) Validade Garantor information/Main address/Contact fieldsets filled;
>
>- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
>0) Search AdditionalGuarantorField preference;
>1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
>2) Select an adult patron;
>3) Insert all information;
>4) Add a new adult patron;
>5) Click "Set to patron" button;
>6) Select the adult patron from 0);
>7) Validade Garantor information/Main address/Contact fieldsets filled;
>8) Validade Garantor additional alternate address/contact filled;
>
>- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
>0) Search AdditionalGuarantorField preference;
>1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
>3) Select an adult patron;
>4) Insert all information;
>5) Click Add guarantiee bouton;
>6) Validade Garantor information/Main address/Contact fieldsets filled;
>7) Validade Garantor additional alternate address/contact filled;
>---
> C4/Members/Attributes.pm                           | 17 +++++++++++++-
> C4/Utils/DataTables/Members.pm                     | 22 ++++++++++++------
> Koha/Schema/Result/Category.pm                     |  8 +++++++
> admin/categories.pl                                |  3 +++
> .../atomicupdate/bug_12446-EnableAdultGarantee.sql | 10 ++++++++
> installer/data/mysql/kohastructure.sql             |  3 ++-
> installer/data/mysql/sysprefs.sql                  |  4 +++-
> .../prog/en/includes/members-toolbar.inc           |  2 +-
> .../prog/en/modules/admin/categories.tt            | 15 ++++++++++++
> .../prog/en/modules/admin/preferences/patrons.pref |  5 ++++
> .../prog/en/modules/members/memberentrygen.tt      | 18 +++++----------
> .../prog/en/modules/members/moremember.tt          | 17 +++++++++++---
> members/memberentry.pl                             | 17 ++++++++++----
> members/moremember.pl                              | 27 +++++++++++-----------
> 14 files changed, 125 insertions(+), 43 deletions(-)
> create mode 100644 installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql
>
>diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm
>index b25a813..b2b0762 100644
>--- a/C4/Members/Attributes.pm
>+++ b/C4/Members/Attributes.pm
>@@ -34,7 +34,7 @@ BEGIN {
>     @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes
>                     DeleteBorrowerAttribute UpdateBorrowerAttribute
>                     extended_attributes_code_value_arrayref extended_attributes_merge
>-                    SearchIdMatchingAttribute);
>+                    SearchIdMatchingAttribute get_guarantor_shared_attributes);
>     %EXPORT_TAGS = ( all => \@EXPORT_OK );
> }
> 
>@@ -357,6 +357,21 @@ sub _sort_by_code {
>     return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
> }
> 
>+=head2 get_guarantor_shared_attributes
>+
>+    $guarantor_attributes = get_guarantor_attributes();
>+
>+    returns an array reference containing attributes to be shared between guarantor and guarantee.
>+=cut
>+sub get_guarantor_shared_attributes{
>+    my @attributes    = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax );
>+    if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){
>+        $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces
>+        @attributes = ( @attributes, @additional);
>+    }
>+    return \@attributes;
>+}
>+
> =head1 AUTHOR
> 
> Koha Development Team <http://koha-community.org/>
>diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm
>index 1ebecd7..49fd1fc 100644
>--- a/C4/Utils/DataTables/Members.pm
>+++ b/C4/Utils/DataTables/Members.pm
>@@ -4,6 +4,7 @@ use Modern::Perl;
> use C4::Branch qw/onlymine/;
> use C4::Context;
> use C4::Members qw/GetMemberIssuesAndFines/;
>+use C4::Members::Attributes qw/get_guarantor_shared_attributes/;
> use C4::Utils::DataTables;
> use Koha::DateUtils;
> 
>@@ -32,13 +33,20 @@ sub search {
>     }
> 
>     my $dbh = C4::Context->dbh;
>-    my $select = "SELECT
>-        borrowers.borrowernumber, borrowers.surname, borrowers.firstname,
>-        borrowers.streetnumber, borrowers.streettype, borrowers.address,
>-        borrowers.address2, borrowers.city, borrowers.state, borrowers.zipcode,
>-        borrowers.country, cardnumber, borrowers.dateexpiry,
>-        borrowers.borrowernotes, borrowers.branchcode, borrowers.email,
>-        borrowers.userid, borrowers.dateofbirth, borrowers.categorycode,
>+    my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode );
>+    if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){
>+        foreach my $item (@guarantor_attributes) {
>+             if (! grep {$_ eq $item} @columns) {
>+                 push @columns, $item;
>+	     }
>+	}
>+    };
>+    my $borrowers_columns = "";
>+    foreach my $item (@columns) {
>+        $borrowers_columns .= "borrowers." . $item . ", ";
>+    }
>+
>+    my $select = "SELECT " . $borrowers_columns . "
>         categories.description AS category_description, categories.category_type,
>         branches.branchname";
>     my $from = "FROM borrowers
>diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm
>index 4926587..e5a40a9 100644
>--- a/Koha/Schema/Result/Category.pm
>+++ b/Koha/Schema/Result/Category.pm
>@@ -109,6 +109,12 @@ __PACKAGE__->table("categories");
>   default_value: -1
>   is_nullable: 0
> 
>+=head2 canbeguarantee
>+
>+  data_type: 'tinyint'
>+  default_value: 0
>+  is_nullable: 0
>+
> =head2 default_privacy
> 
>   data_type: 'enum'
>@@ -154,6 +160,8 @@ __PACKAGE__->add_columns(
>     default_value => -1,
>     is_nullable   => 0,
>   },
>+  "canbeguarantee",
>+  { data_type => "tinyint", default_value => 0, is_nullable => 0},
>   "default_privacy",
>   {
>     data_type => "enum",
>diff --git a/admin/categories.pl b/admin/categories.pl
>index 1370b58..593886c 100755
>--- a/admin/categories.pl
>+++ b/admin/categories.pl
>@@ -91,6 +91,7 @@ elsif ( $op eq 'add_validate' ) {
>     my $category_type = $input->param('category_type');
>     my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
>     my $default_privacy = $input->param('default_privacy');
>+    my $canbeguarantee = $input->param('canbeguarantee');
>     my @branches = grep { $_ ne q{} } $input->param('branches');
> 
>     my $is_a_modif = $input->param("is_a_modif");
>@@ -112,6 +113,7 @@ elsif ( $op eq 'add_validate' ) {
>         $category->hidelostitems($hidelostitems);
>         $category->overduenoticerequired($overduenoticerequired);
>         $category->category_type($category_type);
>+        $category->canbeguarantee($canbeguarantee);
>         $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
>         $category->default_privacy($default_privacy);
>         eval {
>@@ -137,6 +139,7 @@ elsif ( $op eq 'add_validate' ) {
>             hidelostitems => $hidelostitems,
>             overduenoticerequired => $overduenoticerequired,
>             category_type => $category_type,
>+            canbeguarantee => $canbeguarantee,
>             BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
>             default_privacy => $default_privacy,
>         });
>diff --git a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql
>new file mode 100644
>index 0000000..55c2b78
>--- /dev/null
>+++ b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql
>@@ -0,0 +1,10 @@
>+-- ******** --
>+-- SYSPREFS --
>+-- ******** --
>+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
>+VALUES ('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free');
>+
>+-- ********* --
>+-- STRUCTURE --
>+-- ********* --
>+ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0';
>diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
>index 02725fd..1302be2 100644
>--- a/installer/data/mysql/kohastructure.sql
>+++ b/installer/data/mysql/kohastructure.sql
>@@ -488,7 +488,8 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr
>   `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
>   `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
>   `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions
>-  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
>+  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
>+  `canbeguarantee` tinyint(1) NOT NULL default '0'
>   PRIMARY KEY  (`categorycode`),
>   UNIQUE KEY `categorycode` (`categorycode`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
>index aa53139..fdfe94c 100644
>--- a/installer/data/mysql/sysprefs.sql
>+++ b/installer/data/mysql/sysprefs.sql
>@@ -6,6 +6,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
> ('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
> ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'),
> ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
>+('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'),
>+('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'),
> ('AddressFormat','us','','Choose format to display postal addresses', 'Choice'),
> ('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'),
> ('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea'),
>@@ -517,5 +519,5 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
> ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
> ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
> ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
>-('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
>+('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
> ;
>diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
>index 641bbad..7cc0c0e 100644
>--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
>+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
>@@ -146,7 +146,7 @@ function searchToHold(){
> 
>     [% IF ( CAN_user_borrowers ) %]
>         [% IF ( adultborrower AND activeBorrowerRelationship ) %]
>-            <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]"><i class="fa fa-plus"></i> Add child</a>
>+            <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C"><i class="icon-plus"></i> Add guarantee</a>
>         [% END %]
>         [% IF ( CAN_user_borrowers ) %]
>             <a id="changepassword" class="btn btn-small" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]"><i class="fa fa-lock"></i> Change password</a>
>diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
>index d4d0130..4112d44 100644
>--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
>+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
>@@ -238,6 +238,18 @@
>                     </select>
>                     <span class="required">Required</span>
>                 </li>
>+                <li>
>+                    <label for="canbeguarantee">Can be guarantee</label>
>+                    <select name="canbeguarantee" id="canbeguarantee">
>+                        [% IF category.canbeguarantee %]
>+                            <option value="1" selected>Yes</option>
>+                            <option value="0">No</option>
>+                        [% ELSE %]
>+                            <option value="1">Yes</option>
>+                            <option value="0" selected>No</option>
>+                        [% END %]
>+                    <select>
>+                </li>
>                 <li><label for="branches">Branches limitation: </label>
>                     <select id="branches" name="branches" multiple size="10">
>                         <option value="">All branches</option>
>@@ -345,6 +357,7 @@
>                 <tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr>
>                 <tr><th scope="row">Lost items in staff client</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
>                 <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr>
>+                <tr><th scope="row">Can be guarantee</th><td>[% IF category.canbeguarantee %]Yes[% ELSE %]No[% END %]</td></tr>
>                 <tr>
>                     <th scope="row">Default privacy: </th>
>                     <td>
>@@ -401,6 +414,7 @@
>                     <th scope="col">Messaging</th>
>                     [% END %]
>                     <th scope="col">Branches limitations</th>
>+                    <th scope="col">Can be guarantee</th>
>                     <th scope="col">Default privacy</th>
>                     <th scope="col">&nbsp; </th>
>                     <th scope="col">&nbsp; </th>
>@@ -478,6 +492,7 @@
>                                 No limitation
>                             [% END %]
>                         </td>
>+                        <td>[% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %]</td>
>                         <td>
>                             [% SWITCH category.default_privacy %]
>                             [% CASE 'default' %]
>diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
>index ee64970..0b80c92 100644
>--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
>+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
>@@ -159,6 +159,11 @@ Patrons:
>                yes: Do
>                no: "Don't"
>          - charge a fee when a patron changes to a category with an enrollment fee.
>+     -
>+         - "These additional following <a href='http://schema.koha-community.org/tables/borrowers.html' target='blank'>database columns</a> will be transferred from guarantor to guarantee:"
>+         - pref: AdditionalGuarantorField
>+           class: multi
>+         - (separate columns with |)
>     "Norwegian patron database":
>      -
>          - pref: NorwegianPatronDBEnable
>diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
>index e646890..dac1483 100644
>--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
>+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
>@@ -131,14 +131,9 @@
>             .val(borrower.firstname)
>             .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
> 
>-        form.streetnumber.value = borrower.streetnumber;
>-        form.address.value = borrower.address;
>-        form.address2.value = borrower.address2;
>-        form.city.value = borrower.city;
>-        form.state.value = borrower.state;
>-        form.zipcode.value = borrower.zipcode;
>-        form.country.value = borrower.country;
>-        form.branchcode.value = borrower.branchcode;
>+        [% FOREACH field IN guarantor_attributes %]
>+            $(form.[% field %]).val(borrower.[% field %]);
>+        [% END %]
> 
>         form.guarantorsearch.value = _("Change");
> 
>@@ -435,7 +430,6 @@
> 	            [% END %]
> 	        </li>
> [% ELSE %]
>- [% IF ( C ) %]
>  [% IF ( guarantorid ) %]
>  <li id="contact-details">
>  [% ELSE %]
>@@ -453,9 +447,8 @@
>         <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
>      [% END %]
>  </li>
>-        [% END %]
>-        [% UNLESS nocontactfirstname %]
>- <li>
>+     [% UNLESS nocontactfirstname %]
>+<li>
>      <label for="contactfirstname">First name: </label>
>      [% IF ( guarantorid ) %]
>      <span>[% contactfirstname %]</span>
>@@ -1025,6 +1018,7 @@
>                 <li data-category_code="[% patron_attribute.category_code %]">
>                     <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
>                         <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
>+                        <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" />
>                         [% IF ( patron_attribute.use_dropdown ) %]
>                             <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
>                                 <option value=""></option>
>diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
>index 57bd588..c961653 100644
>--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
>+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
>@@ -232,13 +232,24 @@ function validate1(date) {
>     </li>[% END %][% END %]
>     [% IF ( isguarantee ) %]
>         [% IF ( guaranteeloop ) %]
>-            <li><span class="label">Guarantees:</span><ul>[% FOREACH guaranteeloo IN guaranteeloop %]<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %]  </a></li>[% END %]</ul></li>
>+            <li><span class="label">Guarantees:</span>
>+                <table>[% FOREACH guaranteeloo IN guaranteeloop %]
>+                <tr>
>+                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %]</a></td>
>+                    <td style='text-align:right'>[% guaranteeloo.finesguarantee %] $</td>
>+                </tr>[% END %]
>+                <tr>
>+                    <td>Total</td>
>+                    <td style='text-align:right'>[% amounttot %] $</td>
>+                </tr>
>+                </table>
>+            </li>
>         [% END %]
>-    [% ELSE %]
>+    [% END %]
>         [% IF ( guarantorborrowernumber ) %]
>             <li><span class="label">Guarantor:</span><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorborrowernumber %]">[% guarantorsurname %][%IF ( guarantorfirstname ) %], [% guarantorfirstname %] [% END %]</a></li>
>         [% END %]
>-    [% END %]
>+
> </ol>
> </div>
>       <div class="action">
>diff --git a/members/memberentry.pl b/members/memberentry.pl
>index ae54383..fa2f009 100755
>--- a/members/memberentry.pl
>+++ b/members/memberentry.pl
>@@ -39,6 +39,7 @@ use C4::Log;
> use C4::Letters;
> use C4::Branch; # GetBranches
> use C4::Form::MessagingPreferences;
>+use C4::Category;
> use Koha::Borrower::Debarments;
> use Koha::DateUtils;
> use Email::Valid;
>@@ -232,8 +233,9 @@ if ( ( $op eq 'insert' ) and !$nodouble ) {
>     }
> }
> 
>-  #recover all data from guarantor address phone ,fax... 
>-if ( $guarantorid ) {
>+#recover all data from guarantor address phone ,fax...
>+if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {
>+
>     if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
>         $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
>         $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
>@@ -245,8 +247,14 @@ if ( $guarantorid ) {
>                         zipcode country city state phone phonepro mobile fax email emailpro branchcode
>                         B_streetnumber B_streettype B_address B_address2
>                         B_city B_state B_zipcode B_country B_email B_phone)) {
>-		        $newdata{$_} = $guarantordata->{$_};
>+                        $newdata{$_} = $guarantordata->{$_};
> 	        }
>+            my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField");
>+            my @field_add=split(/\|/,$additionalGuarantorField);
>+            my $guarantordata=GetMember(borrowernumber => $guarantorid);
>+            foreach (@field_add) {
>+                $newdata{$_} = $guarantordata->{$_};
>+            }
>         }
>     }
> }
>@@ -674,7 +682,8 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) {
>     $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
> }
> 
>-$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
>+$template->param( "showguarantor"  => $categorycode ? C4::Category->get($categorycode)->{'canbeguarantee'} : 1); # associate with step to know where you are
>+$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
> $debug and warn "memberentry step: $step";
> $template->param(%data);
> $template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
>diff --git a/members/moremember.pl b/members/moremember.pl
>index 482f2a2..80a3170 100755
>--- a/members/moremember.pl
>+++ b/members/moremember.pl
>@@ -171,33 +171,34 @@ if ( $count ) {
>     # the array, which is probably better done as a foreach loop.
>     #
>     my @guaranteedata;
>+    my $amount;
>+    my $totalmount = 0;
>+
>     for ( my $i = 0 ; $i < $count ; $i++ ) {
>+        my ($amount,$accts,undef) = GetMemberAccountRecords($guarantees->[$i]->{'borrowernumber'});
>         push(@guaranteedata,
>             {
>                 borrowernumber => $guarantees->[$i]->{'borrowernumber'},
>                 cardnumber     => $guarantees->[$i]->{'cardnumber'},
>+                finesguarantee => sprintf("%.2f",$amount),
>                 name           => $guarantees->[$i]->{'firstname'} . " "
>                                 . $guarantees->[$i]->{'surname'}
>             }
>         );
>+        $totalmount += $amount;
>     }
>     $template->param( guaranteeloop => \@guaranteedata );
>+    $template->param( amounttot => sprintf("%.2f",$totalmount));
> }
>-else {
>-    if ($data->{'guarantorid'}){
>-	    my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
>-		$template->param(guarantor => 1);
>-		foreach (qw(borrowernumber cardnumber firstname surname)) {        
>-			  $template->param("guarantor$_" => $guarantor->{$_});
>-        }
>+( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
>+
>+if ($data->{'guarantorid'}){
>+    my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
>+    $template->param(guarantor => 1);
>+    foreach (qw(borrowernumber cardnumber firstname surname)) {
>+          $template->param("guarantor$_" => $guarantor->{$_});
>     }
>-	if ($category_type eq 'C'){
>-		$template->param('C' => 1);
>-	}
> }
>-
>-$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' );
>-
> my %bor;
> $bor{'borrowernumber'} = $borrowernumber;
> 
>-- 
>1.9.1
Comment 22 Rémi Mayrand-Provencher 2016-01-06 14:27:17 UTC Comment hidden (obsolete)
Comment 23 Marc Véron 2016-01-06 15:56:33 UTC
One small issue: I have Euro set as active currency, but the table with the Guarantee's fines show the $ sign.
BTW there is a bug pending regarding the display of curreny signs and formats (Bug 4078) .
Comment 24 Rémi Mayrand-Provencher 2016-01-06 18:28:11 UTC Comment hidden (obsolete)
Comment 25 Liz Rea 2016-01-07 02:59:11 UTC
Hi,
I don't see that the atomic update is setting the field for existing categories, with this patch on and the atomic update run, all of the categories (including C and P) are all set to 0 in the database after the update.

Cheers,
Liz
Comment 26 Rémi Mayrand-Provencher 2016-01-11 14:38:40 UTC Comment hidden (obsolete)
Comment 27 Katrin Fischer 2016-03-30 09:08:57 UTC
Lots of work done on this - would be nice to see a sign off!

But a little note from me: While I don't want to complicate things here even more, please consider splitting patches up a bit more in the future. From the initial description this could be 3-4 separate features:
- Enable an adult to have a guarantor;
- Shows guarantees fines in the guarantor's page;
- Transfer some guarantor's information to the guarantee while creating;
- Transfer guarantor's alternate contact to the guarantee while creating. 

This would make the features more visible in bugzilla, but also in the release notes. As right now - the bug title doesn't really describe all that this patch tries to achieve!
Comment 28 Katrin Fischer 2016-03-30 09:09:22 UTC
... also small feature patches tend to move quicker!
Comment 29 Marc Véron 2016-03-30 09:20:18 UTC
Sorry, I get many conflicts while applying the patches.
Comment 30 Charles Farmer 2016-04-01 14:32:04 UTC Comment hidden (obsolete)
Comment 31 Marc Véron 2016-04-02 06:47:18 UTC
Sorry, I get:
Undefined subroutine &main::GetGuarantees called at /usr/share/kohaclone/members/moremember.pl line 180.

I think it is related to Bug 15656 Bug 15656 - Move the guarantor/guarantees code to Koha::Patron (Pushed to aster)
Comment 32 Rémi Mayrand-Provencher 2016-04-28 20:41:05 UTC Comment hidden (obsolete)
Comment 33 Owen Leonard 2016-06-17 12:28:32 UTC
Sorry, this doesn't apply again.

Any patch which touches memberentrygen.tt is really hard to keep up to date!
Comment 34 Mehdi Hamidi 2016-07-20 19:03:22 UTC Comment hidden (obsolete)
Comment 35 Mehdi Hamidi 2016-07-20 19:06:07 UTC Comment hidden (obsolete)
Comment 36 Mehdi Hamidi 2016-07-20 19:51:04 UTC
Created attachment 53536 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;
Comment 37 M. Tompsett 2016-07-27 18:43:51 UTC
Comment on attachment 53536 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

Review of attachment 53536 [details] [review]:
-----------------------------------------------------------------

::: installer/data/mysql/kohastructure.sql
@@ -318,5 @@
>    `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
>    `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
>    `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions
> -  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
> -  `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'.

Where did this go?

::: installer/data/mysql/sysprefs.sql
@@ +544,4 @@
>  ('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'),
>  ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
>  ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
> +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),

No to the comma!

::: koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc
@@ +8,4 @@
>                      <label for="B_streetnumber">
>                  [% END %]
>                  Street Number: </label>
> +                <input type="text" id="B_streetnumber" name="B_streetnumber" size="5" value="[% B_streetnumber %]" />

Potential cut and paste error. Nice catch.

::: koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ +1019,4 @@
>                  <li data-category_code="[% patron_attribute.category_code %]">
>                      <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
>                          <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
> +                        <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" />

If you have the code, why the description?

::: koha-tmpl/intranet-tmpl/prog/js/members.js
@@ -357,5 @@
> -        "bottom": "3%",
> -        "position": "fixed",
> -        "right": "1%",
> -        "width": "150px",
> -    } );

Why did you cut this?

::: members/memberentry.pl
@@ +236,5 @@
>      }
>  }
>  
> +#recover all data from guarantor address phone ,fax...
> +if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {

Why did you add category type? Should not any patron be able to be a guarantor for another? If there is a guarantorid, that should be enough, right?
Comment 38 Mehdi Hamidi 2016-08-02 14:41:46 UTC
Created attachment 53913 [details] [review]
Bug 12446 - QA Follow-up

- Added missing icon on add gurantee
- Removed category restriction when adding new guarentee
- Put back some deleted entries while fixing merging conflicts.
- Fixed some typing errors.
Comment 39 Owen Leonard 2016-08-12 16:06:32 UTC
Does this feature make it inaccurate to label the "Relatives' checkouts" tab as such? "Guarantees' checkouts" perhaps?
Comment 40 Blou 2016-10-07 21:06:39 UTC
That's an easy change, but is this a requirement?  I think it would be more precise, but maybe some would not like this new "unpersonnal phrasing" ?

An easy fix, just let us know if required to reach Signed Off :)
Comment 41 Marc Véron 2017-02-22 08:37:35 UTC
Wanted to test but patch does no longer apply.

Maybe rebasing is a good occasion to address Comment #39 as well ( "Guarantees' checkouts" instead of "Relatives' checkouts" tab).
Comment 42 Kyle M Hall 2017-02-23 11:17:41 UTC
(In reply to Owen Leonard from comment #39)
> Does this feature make it inaccurate to label the "Relatives' checkouts" tab
> as such? "Guarantees' checkouts" perhaps?

I think we us the term colloquially but I've not problem switching our language to guarantees to be technically correct :)

I think we should do that on a separate bug since it affects other parts of Koha not in the purview of this bug patch.
Comment 43 Bouzid Fergani 2017-03-08 19:00:16 UTC Comment hidden (obsolete)
Comment 44 Bouzid Fergani 2017-03-08 19:01:56 UTC Comment hidden (obsolete)
Comment 45 Bouzid Fergani 2017-03-08 19:17:20 UTC
Created attachment 60934 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;
Comment 46 Josef Moravec 2017-05-02 10:14:49 UTC
QA test tool complains: 

 FAIL	C4/Members/Attributes.pm
   FAIL	  pod
		 
		 in file C4/Members/Attributes.pm
		
		Apparent command =cut not preceded by blank line
		*** ERROR: 

 FAIL	C4/Utils/DataTables/Members.pm
   FAIL	  forbidden patterns
		forbidden pattern: tab char (line 58)
		forbidden pattern: tab char (line 59)
   FAIL	  valid
		Can't continue after import errors 
		"GetMemberIssuesAndFines" is not exported by the C4::Members module

 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt
   FAIL	  forbidden patterns
		forbidden pattern: Contains old bootstrap style for buttons (see bug 16239) (line 20)

 FAIL	members/moremember.pl
   FAIL	  forbidden patterns
		forbidden pattern: tab char (line 221)

also the patch does not apply cleanly
Comment 47 Philippe Audet-Fortin 2017-05-04 19:16:44 UTC
Created attachment 63148 [details] [review]
Remove wrong importation in DataTables/Members.pm
Comment 48 Philippe Audet-Fortin 2017-05-04 19:32:49 UTC
Created attachment 63149 [details] [review]
Remove wrong importation in DataTables/Members.pm

https://bugs.koha-community.org/show_bug.cgi?id=12446
Signed-off-by: paudet <paudet@inlibro.com>
Comment 49 Philippe Audet-Fortin 2017-05-05 20:42:51 UTC
Created attachment 63214 [details] [review]
ID change for jQuery listener

In modules/common/patron_search.tt, jQuery was listenning for #borrower_data
but should have listen for #guarantor_data.
Comment 50 Jonathan Druart 2017-05-08 15:05:08 UTC
Comment on attachment 63214 [details] [review]
ID change for jQuery listener

Review of attachment 63214 [details] [review]:
-----------------------------------------------------------------

Philippe,

Please do not add unnecessary changes to your patches:
blank lines, indentation changes, trailing spaces should only be fixed when you are modifying these lines.

::: koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt
@@ +112,4 @@
>      $("body").on("click",".select_user",function(e){
>          e.preventDefault();
>          var borrowernumber = $(this).data("borrowernumber");
> +        var borrower_data = $("#guarantor_data"+borrowernumber).val();

You should not modify existing code without thinking about side-effects.
Assume that existing code is useful and used by other scripts :)

For instance with this change you break admin/add_user_search.pl when called to set the owner of a fund (from admin/aqbudgets.tt).
Comment 51 Jonathan Druart 2017-05-08 15:06:13 UTC
Aware of bug 14570?
Comment 52 Philippe Audet-Fortin 2017-07-04 21:04:13 UTC Comment hidden (obsolete)
Comment 53 Philippe Audet-Fortin 2017-07-04 21:18:18 UTC
Created attachment 64794 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;
Comment 54 Philippe Audet-Fortin 2017-07-05 11:54:13 UTC
I corrected my old mistake (hope it doesn't affect the rest of the code :)) and rebase it. Now the patch apply.
Comment 55 Philippe Audet-Fortin 2017-07-05 11:55:24 UTC Comment hidden (obsolete)
Comment 56 Philippe Audet-Fortin 2017-07-05 19:54:01 UTC
Created attachment 64828 [details] [review]
Bug 12446 - Added a missing comma in kohastructure.sql
Comment 57 Katrin Fischer 2017-10-07 20:42:03 UTC
Sorry, patch no longer applies :(

Bug 12446 - Enable an adult to have a guarantor

64794 - Bug 12446 - Enable an adult to have a guarantor
64828 - Bug 12446 - Added a missing comma in kohastructure.sql

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 12446 - Enable an adult to have a guarantor
Using index info to reconstruct a base tree...
M	installer/data/mysql/kohastructure.sql
M	installer/data/mysql/sysprefs.sql
M	koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
M	koha-tmpl/intranet-tmpl/prog/js/members.js
M	members/memberentry.pl
M	members/moremember.pl
M	svc/members/search
Falling back to patching base and 3-way merge...
Auto-merging svc/members/search
Auto-merging members/moremember.pl
Auto-merging members/memberentry.pl
CONFLICT (content): Merge conflict in members/memberentry.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/js/members.js
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
Auto-merging installer/data/mysql/sysprefs.sql
Auto-merging installer/data/mysql/kohastructure.sql
error: Failed to merge in the changes.
Patch failed at 0001 Bug 12446 - Enable an adult to have a guarantor
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-12446---Enable-an-adult-to-have-a-guarantor-iB_HiD.patch
Comment 58 Roch D'Amour 2018-02-28 23:19:47 UTC
Created attachment 72295 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

I have rebased the patch and corrected some bugs. It should work now :)
Here's the test plan:

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;

Thanks for testing :)
Comment 59 sandboxes@biblibre.com 2018-03-14 15:30:12 UTC
Patch tested with a sandbox, by delaye <stephane.delaye@biblibre.com>
Comment 60 sandboxes@biblibre.com 2018-03-14 15:30:41 UTC
Created attachment 72883 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;

Signed-off-by: delaye <stephane.delaye@biblibre.com>
Comment 61 Katrin Fischer 2018-04-16 06:22:59 UTC
Comment on attachment 72883 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

Review of attachment 72883 [details] [review]:
-----------------------------------------------------------------

Hi Roch,

I've done some initial review, but I am not quite happy with this as is. The biggest problem I see is that it does much more than the bug title advertises. The flag on patron categories and the new preference to decide which patron fields to copy should have been at least 2 bugs. There is also changes to the display like displaying the account balance (which should probably use Price TT?). Please consider splitting the bug when working on it again. 

1) QA script:
 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt
   FAIL	  forbidden patterns
		forbidden pattern: Contains old bootstrap style for buttons (see bug 16239) (line 20)

2) Spinter review:

::: installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql
@@ +6,5 @@
> +
> +-- ********* --
> +-- STRUCTURE --
> +-- ********* --
> +ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0';

Please use AFTER to declare where the column should be added to match with the kohastructure statement. Because depending on when this is pushed, it might lead to a different database structure between new and old installations otherwise.

::: installer/data/mysql/kohastructure.sql
@@ +303,4 @@
>    `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
>    `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
>    `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions
> +  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,

This change is not necessary, no comma needed after the comment.

::: installer/data/mysql/sysprefs.sql
@@ +6,5 @@
>  ('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
>  ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'),
>  ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
> +('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'),
> +('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'),

Change to AddPatronLists seems misplaced here.

::: koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc
@@ +8,4 @@
>        <label for="streetnumber">
>        [% END %]
>        Street number: </label>
> +        <input type="text" id="streetnumber" name="streetnumber" size="5" value="[% streetnumber %]" />

Why only changes to the ...style-us and not the other templates?

::: koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ +154,3 @@
>                          [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
> +                            <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></td>
> +                            <td style='text-align:right'>[% guarantee.account.balance %]</td>

What has this to do with making it possible for adults to be guarantors? ;)

::: members/moremember.pl
@@ +209,5 @@
> +    }
> +    $template->param( guarantees => @guarantees);
> +    $template->param( amounttot => sprintf("%.2f",$totalmount));
> +}
> +( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );

If we set it on the patron category, why check here for I and A?
Comment 62 Katrin Fischer 2018-05-16 23:35:39 UTC
*** Bug 9305 has been marked as a duplicate of this bug. ***
Comment 63 Charles Farmer 2018-08-13 20:40:24 UTC Comment hidden (obsolete)
Comment 64 Charles Farmer 2018-08-13 20:41:01 UTC Comment hidden (obsolete)
Comment 65 Charles Farmer 2018-08-13 20:41:09 UTC
Created attachment 77768 [details] [review]
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally
Comment 66 Charles Farmer 2018-08-13 20:57:24 UTC
New patch to fix, in part, some problems raised by QA.

> Why only changes to the ...style-us and not the other templates?

If I look at it chronologically, this patch was first submitted at a time when no {de,fr} templates existed. Commits for these templates came in 2015 and 2017, and I couldn't say when they were added to the master. It's no excuse for not reworking the patch, if that's what QA needs, but at least there's a rationale: it was rebased over and over without extending what had been done.

> What has this to do with making it possible for adults to be guarantors? ;)

That looks like a prime candidate for an optional patch, I concede. But some of the 'extra' developments in this patch were naturally asked by our clients when we offered linking adults to adults. I do think there are merits to keeping these functionalities together (though perhaps not as far as keeping the example you quoted).

> If we set it on the patron category, why check here for I and A?

Indeed, it's information easily retrievable from the $patron object already sent to the template. Worst of all, it's not even used by any template linked to moremember.pl :/

I feel like that echoes my previous comment about it being an old cookie: it has been rebased many times to quickly offer something to test, but at the cost of not being rewritten everytime to leverage new functions/variables/developments.
Comment 67 Pierre-Marc Thibault 2018-09-24 20:06:00 UTC Comment hidden (obsolete)
Comment 68 Pierre-Marc Thibault 2018-09-24 20:11:57 UTC Comment hidden (obsolete)
Comment 69 Pierre-Marc Thibault 2018-09-24 20:12:22 UTC Comment hidden (obsolete)
Comment 70 Pierre-Marc Thibault 2018-09-24 20:27:47 UTC
Created attachment 79347 [details] [review]
Bug 12446 - Enable an adult to have a guarantor

Bug 12446 - Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;

Signed-off-by: delaye <stephane.delaye@biblibre.com>
Comment 71 Pierre-Marc Thibault 2018-09-24 20:27:58 UTC
Created attachment 79348 [details] [review]
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally

Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally
Comment 72 Katrin Fischer 2018-09-26 05:28:45 UTC
> > Why only changes to the ...style-us and not the other templates?
> 
> If I look at it chronologically, this patch was first submitted at a time
> when no {de,fr} templates existed. Commits for these templates came in 2015
> and 2017, and I couldn't say when they were added to the master. It's no
> excuse for not reworking the patch, if that's what QA needs, but at least
> there's a rationale: it was rebased over and over without extending what had
> been done.

I see the follow-up doesn't contain changes to the other address format files still, could you please check?

> > What has this to do with making it possible for adults to be guarantors? ;)
> 
> That looks like a prime candidate for an optional patch, I concede. But some
> of the 'extra' developments in this patch were naturally asked by our
> clients when we offered linking adults to adults. I do think there are
> merits to keeping these functionalities together (though perhaps not as far
> as keeping the example you quoted).

I understand that it happens, my main point is documentation. By slipping in features into bugs without documenting them at least in the commit message, they often get lost and end up undocumented, especially when they don't fit the bugs description which is often all people look at in release notes.

I hope to see this signed off soon!
Comment 73 Martin Renvoize 2018-10-29 12:12:37 UTC
I took a quick look at the revised code and I'm afraid it still looks like some additional cleanup is required.

1) C4::Utils::Datatables::Members::search seems to duplicate code which has been modified in the interim.
2) Not sure how 'AddPatronLists' syspref comes into this?
3) I also agree this would be significantly simpler to SO and QA if it were split into two bugs.
Comment 74 Maryse Simard 2019-02-13 23:04:57 UTC
Created attachment 85069 [details] [review]
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page

Only one guarantee is shown on the guarantor detail page. The
guarantees list should be passed to the template as a ref.
Comment 75 Pierre-Marc Thibault 2019-04-19 18:03:02 UTC
Created attachment 88364 [details] [review]
Bug 12446: Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;
Comment 76 Pierre-Marc Thibault 2019-04-19 18:03:07 UTC
Created attachment 88365 [details] [review]
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally
Comment 77 Pierre-Marc Thibault 2019-04-19 18:03:12 UTC
Created attachment 88366 [details] [review]
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page

Only one guarantee is shown on the guarantor detail page. The
guarantees list should be passed to the template as a ref.
Comment 78 Pierre-Marc Thibault 2019-04-19 18:03:17 UTC
Created attachment 88367 [details] [review]
Bug 12446: (QA follow-up) QA tests fixing, cleaning code

This patch does 3 things :
- Remove old code in C4/Utils/DataTables/Members.pm.
- Fix the AdditionalGuarantorField dead link for the borrowers table schema.
- Remove unused variables so QA tests pass.
Comment 79 Pierre-Marc Thibault 2019-04-19 18:09:58 UTC
(In reply to Martin Renvoize from comment #73)
> I took a quick look at the revised code and I'm afraid it still looks like
> some additional cleanup is required.
> 
> 1) C4::Utils::Datatables::Members::search seems to duplicate code which has
> been modified in the interim.
> 2) Not sure how 'AddPatronLists' syspref comes into this?
> 3) I also agree this would be significantly simpler to SO and QA if it were
> split into two bugs.

1) I added a new patch which removes the duplicated code.
2) AddPatronLists doesn't come into this. If it has been added, it has been removed in the next patch.
Comment 80 Katrin Fischer 2019-04-28 23:09:04 UTC
*** Bug 6922 has been marked as a duplicate of this bug. ***
Comment 81 Nadine Pierre 2019-06-06 19:00:37 UTC
Created attachment 90389 [details] [review]
Bug 12446: Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;
Comment 82 Nadine Pierre 2019-06-06 19:00:46 UTC
Created attachment 90390 [details] [review]
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally
Comment 83 Nadine Pierre 2019-06-06 19:00:52 UTC
Created attachment 90391 [details] [review]
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page

Only one guarantee is shown on the guarantor detail page. The
guarantees list should be passed to the template as a ref.
Comment 84 Nadine Pierre 2019-06-06 19:01:00 UTC
Created attachment 90392 [details] [review]
Bug 12446: (QA follow-up) QA tests fixing, cleaning code

This patch does 3 things :
- Remove old code in C4/Utils/DataTables/Members.pm.
- Fix the AdditionalGuarantorField dead link for the borrowers table schema.
- Remove unused variables so QA tests pass.
Comment 85 Nadine Pierre 2019-06-06 19:03:01 UTC
I rebased the patches against master.
Ready to be tested.
Comment 86 Hayley Mapley 2019-06-11 03:33:53 UTC
Created attachment 90470 [details] [review]
Bug 12446: Enable an adult to have a guarantor

Concflicts has been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenerios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantiee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantiee bouton;
3) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validade Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validade Garantor information/Main address/Contact fieldsets filled;
8) Validade Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantiee bouton;
6) Validade Garantor information/Main address/Contact fieldsets filled;
7) Validade Garantor additional alternate address/contact filled;

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 87 Hayley Mapley 2019-06-11 03:33:59 UTC
Created attachment 90471 [details] [review]
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 88 Hayley Mapley 2019-06-11 03:34:06 UTC
Created attachment 90472 [details] [review]
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page

Only one guarantee is shown on the guarantor detail page. The
guarantees list should be passed to the template as a ref.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 89 Hayley Mapley 2019-06-11 03:34:12 UTC
Created attachment 90473 [details] [review]
Bug 12446: (QA follow-up) QA tests fixing, cleaning code

This patch does 3 things :
- Remove old code in C4/Utils/DataTables/Members.pm.
- Fix the AdditionalGuarantorField dead link for the borrowers table schema.
- Remove unused variables so QA tests pass.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 90 Katrin Fischer 2019-09-02 06:12:10 UTC
I am sorry, but there are a lot of conflicts now with this patch.
With bug 14570 pushed, this might need to be reworked.
Comment 91 Maryse Simard 2019-10-01 20:02:23 UTC
Created attachment 93388 [details] [review]
Bug 12446: Enable an adult to have a guarantor

Conflicts have been fixed. Also attributes in system preference : AdditionalGuarantorField are now displayed correctly in all scenarios.

I have rebased every patch.
This includes all the features from the previous patches.

Removed the dollar signs and stopped using C4::Category

On the patron category page, there is a new field to specify whether patrons can be guarantee or not.
The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P".

1) Apply the patch
2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories.
3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional it should have been set by default)
4) See below to test various scenarios

- Enable an adult to have a guarantor:
0.0) Create or edit a patron category of type 'A'.
0.1) Set the "Can be guarantee" field to "Yes" and save.
1) Select an adult patron -> details tab;
2) Click edit button;
3) validate "guarantor information" fieldset;

- Shows guarantees' fines in the guarantor's page:
4) Click Set to patron button and select a guarantor;
5) Generate a fine;
6) Select guarantor patron -> details tab;
7) Validate guarantee's fine information.

- Transfer some guarantor's information to the guarantee while adding a guarantee:
0) Select an adult patron;
1) Insert all information;
2) Click Add guarantee bouton;
3) Validate Garantor information/Main address/Contact fieldsets filled;

- Transfer some guarantor's information to the guarantee while creating a new patron
0) Select an adult patron;
1) Insert all information;
2) Add a new adult patron;
3) Click "Set to patron" button;
4) Select the adult patron from 0);
5) Validate Garantor information/Main address/Contact fieldsets filled;

- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
2) Select an adult patron;
3) Insert all information;
4) Add a new adult patron;
5) Click "Set to patron" button;
6) Select the adult patron from 0);
7) Validate Garantor information/Main address/Contact fieldsets filled;
8) Validate Garantor additional alternate address/contact filled;

- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantee:
0) Search AdditionalGuarantorField preference;
1) Insert some additional database columns from alternate address/contact to be transferred from guarantor;
3) Select an adult patron;
4) Insert all information;
5) Click Add guarantee bouton;
6) Validate Garantor information/Main address/Contact fieldsets filled;
7) Validate Garantor additional alternate address/contact filled;

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 92 Maryse Simard 2019-10-01 20:03:07 UTC
Created attachment 93389 [details] [review]
Bug 12446: (QA follow-up) Cleaning, and fixing, old code carried accidentally

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 93 Maryse Simard 2019-10-01 20:03:13 UTC
Created attachment 93390 [details] [review]
Bug 12446: (follow-up) Show all guarantees on the guarantor detail page

Only one guarantee is shown on the guarantor detail page. The
guarantees list should be passed to the template as a ref.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 94 Maryse Simard 2019-10-01 20:03:19 UTC
Created attachment 93391 [details] [review]
Bug 12446: (QA follow-up) QA tests fixing, cleaning code

This patch does 3 things :
- Remove old code in C4/Utils/DataTables/Members.pm.
- Fix the AdditionalGuarantorField dead link for the borrowers table schema.
- Remove unused variables so QA tests pass.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 95 Maryse Simard 2019-10-01 20:03:24 UTC
Created attachment 93392 [details] [review]
Bug 12446: Schema update Category.pm
Comment 96 Maryse Simard 2019-10-01 20:03:30 UTC
Created attachment 93393 [details] [review]
Bug 12446: (follow-up) Remove mandatory transfered values

With the new system preference AdditionalGuarantorField, one can add
data to be transfered to the guarantee, but cannot remove default ones.

This patch renames the syspref to GuarantorFields and set hardcoded
default values as the preference's default.

To test:
1. After database update, check that the default value for the syspref
GuarantorFields contains these columns:
    streetnumber|address|address2|city|state|zipcode|country|
    branchcode|phonepro|mobile|email|emailpro|fax
2. Set the value as empty
3. Try adding a guarantor to a patron (from the guarantor's page or the
guarantee's): no values should be imported.
4. Check that it still works with different values for the preference.
Comment 97 Maryse Simard 2019-10-01 20:03:35 UTC
Created attachment 93394 [details] [review]
Bug 12446: (follow-up) Code cleaning

Some variable name change,
put database update in a perl file,
remove unused code
and other small fixes.
Comment 98 Maryse Simard 2019-10-01 20:07:35 UTC
I rebased the patches. The code has changed a lot with bug 14570, please retest.

I've also made some fixes and changed the new system preference AdditionalGuarantorField to GuarantorFields. This way, the system can be set so no information is transfered to the guarantee while adding a guarantor. The test plan for this change is in the patch's commit message.
Comment 99 Martin Renvoize 2019-10-25 16:25:19 UTC
This will need to update the cleanup routine introduced in bug 17168.
Comment 100 Maryse Simard 2019-11-13 21:11:03 UTC
Created attachment 95411 [details] [review]
Bug 12446: (follow-up) Update for Bug 17168