View | Details | Raw Unified | Return to bug 12446
Collapse All | Expand All

(-)a/C4/Members/Attributes.pm (-1 / +16 lines)
Lines 32-38 BEGIN { Link Here
32
    @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes
32
    @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes
33
                    DeleteBorrowerAttribute UpdateBorrowerAttribute
33
                    DeleteBorrowerAttribute UpdateBorrowerAttribute
34
                    extended_attributes_code_value_arrayref extended_attributes_merge
34
                    extended_attributes_code_value_arrayref extended_attributes_merge
35
                    SearchIdMatchingAttribute);
35
                    SearchIdMatchingAttribute get_guarantor_shared_attributes);
36
    %EXPORT_TAGS = ( all => \@EXPORT_OK );
36
    %EXPORT_TAGS = ( all => \@EXPORT_OK );
37
}
37
}
38
38
Lines 381-386 sub _sort_by_code { Link Here
381
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
381
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
382
}
382
}
383
383
384
=head2 get_guarantor_shared_attributes
385
386
    $guarantor_attributes = get_guarantor_attributes();
387
388
    returns an array reference containing attributes to be shared between guarantor and guarantee.
389
=cut
390
sub get_guarantor_shared_attributes{
391
    my @attributes    = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax );
392
    if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){
393
        $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces
394
        @attributes = ( @attributes, @additional);
395
    }
396
    return \@attributes;
397
}
398
384
=head1 AUTHOR
399
=head1 AUTHOR
385
400
386
Koha Development Team <http://koha-community.org/>
401
Koha Development Team <http://koha-community.org/>
(-)a/C4/Utils/DataTables/Members.pm (-7 / +15 lines)
Lines 4-9 use Modern::Perl; Link Here
4
use C4::Branch qw/onlymine/;
4
use C4::Branch qw/onlymine/;
5
use C4::Context;
5
use C4::Context;
6
use C4::Members qw/GetMemberIssuesAndFines/;
6
use C4::Members qw/GetMemberIssuesAndFines/;
7
use C4::Members::Attributes qw/get_guarantor_shared_attributes/;
7
use C4::Utils::DataTables;
8
use C4::Utils::DataTables;
8
use Koha::DateUtils;
9
use Koha::DateUtils;
9
10
Lines 32-44 sub search { Link Here
32
    }
33
    }
33
34
34
    my $dbh = C4::Context->dbh;
35
    my $dbh = C4::Context->dbh;
35
    my $select = "SELECT
36
    my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode );
36
        borrowers.borrowernumber, borrowers.surname, borrowers.firstname,
37
    if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){
37
        borrowers.streetnumber, borrowers.streettype, borrowers.address,
38
        foreach my $item (@guarantor_attributes) {
38
        borrowers.address2, borrowers.city, borrowers.state, borrowers.zipcode,
39
             if (! grep {$_ eq $item} @columns) {
39
        borrowers.country, cardnumber, borrowers.dateexpiry,
40
                 push @columns, $item;
40
        borrowers.borrowernotes, borrowers.branchcode, borrowers.email,
41
	     }
41
        borrowers.userid, borrowers.dateofbirth, borrowers.categorycode,
42
	}
43
    };
44
    my $borrowers_columns = "";
45
    foreach my $item (@columns) {
46
        $borrowers_columns .= "borrowers." . $item . ", ";
47
    }
48
49
    my $select = "SELECT " . $borrowers_columns . "
42
        categories.description AS category_description, categories.category_type,
50
        categories.description AS category_description, categories.category_type,
43
        branches.branchname";
51
        branches.branchname";
44
    my $from = "FROM borrowers
52
    my $from = "FROM borrowers
(-)a/Koha/Schema/Result/Category.pm (+8 lines)
Lines 109-114 __PACKAGE__->table("categories"); Link Here
109
  default_value: -1
109
  default_value: -1
110
  is_nullable: 0
110
  is_nullable: 0
111
111
112
=head2 canbeguarantee
113
114
  data_type: 'tinyint'
115
  default_value: 0
116
  is_nullable: 0
117
112
=head2 default_privacy
118
=head2 default_privacy
113
119
114
  data_type: 'enum'
120
  data_type: 'enum'
Lines 154-159 __PACKAGE__->add_columns( Link Here
154
    default_value => -1,
160
    default_value => -1,
155
    is_nullable   => 0,
161
    is_nullable   => 0,
156
  },
162
  },
163
  "canbeguarantee",
164
  { data_type => "tinyint", default_value => 0, is_nullable => 0},
157
  "default_privacy",
165
  "default_privacy",
158
  {
166
  {
159
    data_type => "enum",
167
    data_type => "enum",
(-)a/admin/categories.pl (+3 lines)
Lines 92-97 elsif ( $op eq 'add_validate' ) { Link Here
92
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
92
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
93
    my $default_privacy = $input->param('default_privacy');
93
    my $default_privacy = $input->param('default_privacy');
94
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
94
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
95
    my $canbeguarantee = $input->param('canbeguarantee');
95
96
96
    my $is_a_modif = $input->param("is_a_modif");
97
    my $is_a_modif = $input->param("is_a_modif");
97
98
Lines 112-117 elsif ( $op eq 'add_validate' ) { Link Here
112
        $category->hidelostitems($hidelostitems);
113
        $category->hidelostitems($hidelostitems);
113
        $category->overduenoticerequired($overduenoticerequired);
114
        $category->overduenoticerequired($overduenoticerequired);
114
        $category->category_type($category_type);
115
        $category->category_type($category_type);
116
        $category->canbeguarantee($canbeguarantee);
115
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
117
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
116
        $category->default_privacy($default_privacy);
118
        $category->default_privacy($default_privacy);
117
        eval {
119
        eval {
Lines 137-142 elsif ( $op eq 'add_validate' ) { Link Here
137
            hidelostitems => $hidelostitems,
139
            hidelostitems => $hidelostitems,
138
            overduenoticerequired => $overduenoticerequired,
140
            overduenoticerequired => $overduenoticerequired,
139
            category_type => $category_type,
141
            category_type => $category_type,
142
            canbeguarantee => $canbeguarantee,
140
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
143
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
141
            default_privacy => $default_privacy,
144
            default_privacy => $default_privacy,
142
        });
145
        });
(-)a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql (+11 lines)
Line 0 Link Here
1
-- ******** --
2
-- SYSPREFS --
3
-- ******** --
4
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
5
VALUES ('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free');
6
7
-- ********* --
8
-- STRUCTURE --
9
-- ********* --
10
#ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0';
11
UPDATE categories SET canbeguarantee = 1 WHERE category_type = 'P' OR category_type = 'C';
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 502-508 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
502
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
502
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
503
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
503
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
504
  `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
504
  `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
505
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
505
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
506
  `canbeguarantee` tinyint(1) NOT NULL default '0'
506
  PRIMARY KEY  (`categorycode`),
507
  PRIMARY KEY  (`categorycode`),
507
  UNIQUE KEY `categorycode` (`categorycode`)
508
  UNIQUE KEY `categorycode` (`categorycode`)
508
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
509
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
(-)a/installer/data/mysql/sysprefs.sql (-1 / +3 lines)
Lines 6-11 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
6
('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
6
('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
7
('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'),
7
('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'),
8
('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
8
('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
9
('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'),
10
('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'),
9
('AddressFormat','us','','Choose format to display postal addresses', 'Choice'),
11
('AddressFormat','us','','Choose format to display postal addresses', 'Choice'),
10
('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'),
12
('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'),
11
('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea'),
13
('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea'),
Lines 534-538 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
534
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
536
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
535
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
537
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
536
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
538
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
537
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
539
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
538
;
540
;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (-1 / +1 lines)
Lines 146-152 function searchToHold(){ Link Here
146
146
147
    [% IF ( CAN_user_borrowers ) %]
147
    [% IF ( CAN_user_borrowers ) %]
148
        [% IF ( adultborrower AND activeBorrowerRelationship ) %]
148
        [% IF ( adultborrower AND activeBorrowerRelationship ) %]
149
            <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>
149
            <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>
150
        [% END %]
150
        [% END %]
151
        [% IF ( CAN_user_borrowers ) %]
151
        [% IF ( CAN_user_borrowers ) %]
152
            <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>
152
            <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>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+15 lines)
Lines 238-243 Link Here
238
                    </select>
238
                    </select>
239
                    <span class="required">Required</span>
239
                    <span class="required">Required</span>
240
                </li>
240
                </li>
241
                <li>
242
                    <label for="canbeguarantee">Can be guarantee</label>
243
                    <select name="canbeguarantee" id="canbeguarantee">
244
                        [% IF category.canbeguarantee %]
245
                            <option value="1" selected>Yes</option>
246
                            <option value="0">No</option>
247
                        [% ELSE %]
248
                            <option value="1">Yes</option>
249
                            <option value="0" selected>No</option>
250
                        [% END %]
251
                    <select>
252
                </li>
241
                <li><label for="branches">Branches limitation: </label>
253
                <li><label for="branches">Branches limitation: </label>
242
                    <select id="branches" name="branches" multiple size="10">
254
                    <select id="branches" name="branches" multiple size="10">
243
                        <option value="">All branches</option>
255
                        <option value="">All branches</option>
Lines 345-350 Link Here
345
                <tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr>
357
                <tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr>
346
                <tr><th scope="row">Lost items in staff client</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
358
                <tr><th scope="row">Lost items in staff client</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
347
                <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr>
359
                <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr>
360
                <tr><th scope="row">Can be guarantee</th><td>[% IF category.canbeguarantee %]Yes[% ELSE %]No[% END %]</td></tr>
348
                <tr>
361
                <tr>
349
                    <th scope="row">Default privacy: </th>
362
                    <th scope="row">Default privacy: </th>
350
                    <td>
363
                    <td>
Lines 401-406 Link Here
401
                    <th scope="col">Messaging</th>
414
                    <th scope="col">Messaging</th>
402
                    [% END %]
415
                    [% END %]
403
                    <th scope="col">Branches limitations</th>
416
                    <th scope="col">Branches limitations</th>
417
                    <th scope="col">Can be guarantee</th>
404
                    <th scope="col">Default privacy</th>
418
                    <th scope="col">Default privacy</th>
405
                    <th scope="col">&nbsp; </th>
419
                    <th scope="col">&nbsp; </th>
406
                    <th scope="col">&nbsp; </th>
420
                    <th scope="col">&nbsp; </th>
Lines 478-483 Link Here
478
                                No limitation
492
                                No limitation
479
                            [% END %]
493
                            [% END %]
480
                        </td>
494
                        </td>
495
                        <td>[% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %]</td>
481
                        <td>
496
                        <td>
482
                            [% SWITCH category.default_privacy %]
497
                            [% SWITCH category.default_privacy %]
483
                            [% CASE 'default' %]
498
                            [% CASE 'default' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+5 lines)
Lines 159-164 Patrons: Link Here
159
               yes: Do
159
               yes: Do
160
               no: "Don't"
160
               no: "Don't"
161
         - charge a fee when a patron changes to a category with an enrollment fee.
161
         - charge a fee when a patron changes to a category with an enrollment fee.
162
     -
163
         - "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:"
164
         - pref: AdditionalGuarantorField
165
           class: multi
166
         - (separate columns with |)
162
    "Norwegian patron database":
167
    "Norwegian patron database":
163
     -
168
     -
164
         - pref: NorwegianPatronDBEnable
169
         - pref: NorwegianPatronDBEnable
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-12 / +6 lines)
Lines 118-131 function select_user(borrowernumber, borrower) { Link Here
118
		.val(borrower.firstname)
118
		.val(borrower.firstname)
119
		.before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
119
		.before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
120
120
121
	form.streetnumber.value = borrower.streetnumber;
121
    [% FOREACH field IN guarantor_attributes %]
122
	form.address.value = borrower.address;
122
        $(form.[% field %]).val(borrower.[% field %]);
123
	form.address2.value = borrower.address2;
123
    [% END %]
124
	form.city.value = borrower.city;
125
	form.state.value = borrower.state;
126
	form.zipcode.value = borrower.zipcode;
127
	form.country.value = borrower.country;
128
	form.branchcode.value = borrower.branchcode;
129
124
130
	form.guarantorsearch.value = _("Change");
125
	form.guarantorsearch.value = _("Change");
131
126
Lines 446-452 function select_user(borrowernumber, borrower) { Link Here
446
	            [% END %]
441
	            [% END %]
447
	        </li>
442
	        </li>
448
[% ELSE %]
443
[% ELSE %]
449
 [% IF ( C ) %]
450
 [% IF ( guarantorid ) %]
444
 [% IF ( guarantorid ) %]
451
 <li id="contact-details">
445
 <li id="contact-details">
452
 [% ELSE %]
446
 [% ELSE %]
Lines 464-472 function select_user(borrowernumber, borrower) { Link Here
464
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
458
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
465
     [% END %]
459
     [% END %]
466
 </li>
460
 </li>
467
        [% END %]
461
     [% UNLESS nocontactfirstname %]
468
        [% UNLESS nocontactfirstname %]
462
<li>
469
 <li>
470
     <label for="contactfirstname">First name: </label>
463
     <label for="contactfirstname">First name: </label>
471
     [% IF ( guarantorid ) %]
464
     [% IF ( guarantorid ) %]
472
     <span>[% contactfirstname %]</span>
465
     <span>[% contactfirstname %]</span>
Lines 1044-1049 function select_user(borrowernumber, borrower) { Link Here
1044
                <li data-category_code="[% patron_attribute.category_code %]">
1037
                <li data-category_code="[% patron_attribute.category_code %]">
1045
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1038
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1046
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1039
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1040
                        <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" />
1047
                        [% IF ( patron_attribute.use_dropdown ) %]
1041
                        [% IF ( patron_attribute.use_dropdown ) %]
1048
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1042
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1049
                                <option value=""></option>
1043
                                <option value=""></option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-11 / +17 lines)
Lines 198-204 function validate1(date) { Link Here
198
   [% title %] [% firstname %] [% END %] [% surname %] ([% cardnumber %])</h3>
198
   [% title %] [% firstname %] [% END %] [% surname %] ([% cardnumber %])</h3>
199
 <div class="yui-u first">
199
 <div class="yui-u first">
200
<div id="patron-information" style="padding : .5em;">
200
<div id="patron-information" style="padding : .5em;">
201
202
     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
201
     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
203
202
204
    <div class = "address">
203
    <div class = "address">
Lines 234-249 function validate1(date) { Link Here
234
    [% IF ( sex ) %]<li><span class="label">Gender:</span>
233
    [% IF ( sex ) %]<li><span class="label">Gender:</span>
235
    [% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
234
    [% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
236
    </li>[% END %][% END %]
235
    </li>[% END %][% END %]
237
    [% IF guarantees %]
236
    [% IF ( isguarantee ) %]
238
        <li>
237
        [% IF ( guaranteeloop ) %]
239
            <span class="label">Guarantees:</span>
238
            <li><span class="label">Guarantees:</span>
240
            <ul>
239
                <table>[% FOREACH guaranteeloo IN guaranteeloop %]
241
                [% FOREACH guarantee IN guarantees %]
240
                <tr>
242
                    <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname %] [% guarantee.surname %]</a></li>
241
                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %]</a></td>
243
                [% END %]
242
                    <td style='text-align:right'>[% guaranteeloo.finesguarantee %]</td>
244
            </ul>
243
                </tr>[% END %]
245
        </li>
244
                <tr>
246
    [% ELSIF guarantor %]
245
                    <td>Total</td>
246
                    <td style='text-align:right'>[% amounttot %]</td>
247
                </tr>
248
                </table>
249
            </li>
250
        [% END %]
251
    [% END %]
252
    [% IF ( isguarantor ) %]
247
        <li>
253
        <li>
248
            <span class="label">Guarantor:</span>
254
            <span class="label">Guarantor:</span>
249
            [% IF guarantor.borrowernumber %]
255
            [% IF guarantor.borrowernumber %]
(-)a/members/memberentry.pl (-4 / +14 lines)
Lines 39-44 use C4::Log; Link Here
39
use C4::Letters;
39
use C4::Letters;
40
use C4::Branch; # GetBranches
40
use C4::Branch; # GetBranches
41
use C4::Form::MessagingPreferences;
41
use C4::Form::MessagingPreferences;
42
use Koha::Patron::Categories;
42
use Koha::Patron::Debarments;
43
use Koha::Patron::Debarments;
43
use Koha::Cities;
44
use Koha::Cities;
44
use Koha::DateUtils;
45
use Koha::DateUtils;
Lines 237-244 if ( ( $op eq 'insert' ) and !$nodouble ) { Link Here
237
    }
238
    }
238
}
239
}
239
240
240
  #recover all data from guarantor address phone ,fax... 
241
#recover all data from guarantor address phone ,fax...
241
if ( $guarantorid ) {
242
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {
243
242
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
244
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
243
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
245
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
244
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
246
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
Lines 250-257 if ( $guarantorid ) { Link Here
250
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
252
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
251
                        B_streetnumber B_streettype B_address B_address2
253
                        B_streetnumber B_streettype B_address B_address2
252
                        B_city B_state B_zipcode B_country B_email B_phone)) {
254
                        B_city B_state B_zipcode B_country B_email B_phone)) {
253
		        $newdata{$_} = $guarantordata->{$_};
255
                        $newdata{$_} = $guarantordata->{$_};
254
	        }
256
	        }
257
            my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField");
258
            my @field_add=split(/\|/,$additionalGuarantorField);
259
            my $guarantordata=GetMember(borrowernumber => $guarantorid);
260
            foreach (@field_add) {
261
                $newdata{$_} = $guarantordata->{$_};
262
            }
255
        }
263
        }
256
    }
264
    }
257
}
265
}
Lines 662-668 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
662
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
670
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
663
}
671
}
664
672
665
$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
673
$template->param( "showguarantor"  => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are
674
675
$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
666
$debug and warn "memberentry step: $step";
676
$debug and warn "memberentry step: $step";
667
$template->param(%data);
677
$template->param(%data);
668
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
678
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
(-)a/members/moremember.pl (-4 / +30 lines)
Lines 166-172 if ( $category_type eq 'C') { Link Here
166
my $patron = Koha::Patrons->find($data->{borrowernumber});
166
my $patron = Koha::Patrons->find($data->{borrowernumber});
167
my @relatives;
167
my @relatives;
168
if ( my $guarantor = $patron->guarantor ) {
168
if ( my $guarantor = $patron->guarantor ) {
169
    $template->param( guarantor => $guarantor );
170
    push @relatives, $guarantor->borrowernumber;
169
    push @relatives, $guarantor->borrowernumber;
171
    push @relatives, $_->borrowernumber for $patron->siblings;
170
    push @relatives, $_->borrowernumber for $patron->siblings;
172
} elsif ( $patron->contactname || $patron->contactfirstname ) {
171
} elsif ( $patron->contactname || $patron->contactfirstname ) {
Lines 178-192 if ( my $guarantor = $patron->guarantor ) { Link Here
178
    );
177
    );
179
} else {
178
} else {
180
    my @guarantees = $patron->guarantees;
179
    my @guarantees = $patron->guarantees;
181
    $template->param( guarantees => \@guarantees );
182
    push @relatives, $_->borrowernumber for @guarantees;
180
    push @relatives, $_->borrowernumber for @guarantees;
183
}
181
}
184
182
185
my $relatives_issues_count =
183
my $relatives_issues_count =
186
  Koha::Database->new()->schema()->resultset('Issue')
184
  Koha::Database->new()->schema()->resultset('Issue')
187
  ->count( { borrowernumber => \@relatives } );
185
  ->count( { borrowernumber => \@relatives } );
186
my @guarantees = $patron->guarantees;
187
my $count = scalar @guarantees;
188
if ( $count ) {
189
    $template->param( isguarantee => 1 );
190
191
    my @guaranteedata;
192
    my $amount;
193
    my $totalmount = 0;
194
195
    foreach my $guarantee (@guarantees){
196
        my ($amount,$accts,undef) = GetMemberAccountRecords($guarantee->borrowernumber);
197
        push(@guaranteedata,
198
            {
199
                borrowernumber => $guarantee->borrowernumber,
200
                cardnumber     => $guarantee->cardnumber,
201
                finesguarantee => sprintf("%.2f",$amount),
202
                name           => $guarantee->firstname . " "
203
                                . $guarantee->surname
204
            }
205
        );
206
        $totalmount += $amount;
207
    }
208
    $template->param( guaranteeloop => \@guaranteedata );
209
    $template->param( amounttot => sprintf("%.2f",$totalmount));
210
}
211
( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
188
212
189
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' );
213
if (my $guarantor = $patron->guarantor){
214
	$template->param(isguarantor => 1);
215
    $template->param(guarantor => $guarantor);
216
}
190
217
191
my %bor;
218
my %bor;
192
$bor{'borrowernumber'} = $borrowernumber;
219
$bor{'borrowernumber'} = $borrowernumber;
193
- 

Return to bug 12446