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 388-393 sub _sort_by_code { Link Here
388
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
388
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
389
}
389
}
390
390
391
=head2 get_guarantor_shared_attributes
392
393
    $guarantor_attributes = get_guarantor_attributes();
394
395
    returns an array reference containing attributes to be shared between guarantor and guarantee.
396
=cut
397
sub get_guarantor_shared_attributes{
398
    my @attributes    = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax );
399
    if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){
400
        $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces
401
        @attributes = ( @attributes, @additional);
402
    }
403
    return \@attributes;
404
}
405
391
=head1 AUTHOR
406
=head1 AUTHOR
392
407
393
Koha Development Team <http://koha-community.org/>
408
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 91-96 elsif ( $op eq 'add_validate' ) { Link Here
91
    my $category_type = $input->param('category_type');
91
    my $category_type = $input->param('category_type');
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 $canbeguarantee = $input->param('canbeguarantee');
94
    my @branches = grep { $_ ne q{} } $input->param('branches');
95
    my @branches = grep { $_ ne q{} } $input->param('branches');
95
96
96
    my $is_a_modif = $input->param("is_a_modif");
97
    my $is_a_modif = $input->param("is_a_modif");
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 504-510 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
504
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
504
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
505
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
505
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
506
  `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
506
  `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
507
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
507
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
508
  `canbeguarantee` tinyint(1) NOT NULL default '0'
508
  PRIMARY KEY  (`categorycode`),
509
  PRIMARY KEY  (`categorycode`),
509
  UNIQUE KEY `categorycode` (`categorycode`)
510
  UNIQUE KEY `categorycode` (`categorycode`)
510
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
511
) 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 525-529 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
525
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
527
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
526
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
528
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
527
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
529
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
528
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
530
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
529
;
531
;
(-)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 116-129 function select_user(borrowernumber, borrower) { Link Here
116
		.val(borrower.firstname)
116
		.val(borrower.firstname)
117
		.before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
117
		.before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
118
118
119
	form.streetnumber.value = borrower.streetnumber;
119
    [% FOREACH field IN guarantor_attributes %]
120
	form.address.value = borrower.address;
120
        $(form.[% field %]).val(borrower.[% field %]);
121
	form.address2.value = borrower.address2;
121
    [% END %]
122
	form.city.value = borrower.city;
123
	form.state.value = borrower.state;
124
	form.zipcode.value = borrower.zipcode;
125
	form.country.value = borrower.country;
126
	form.branchcode.value = borrower.branchcode;
127
122
128
	form.guarantorsearch.value = _("Change");
123
	form.guarantorsearch.value = _("Change");
129
124
Lines 444-450 function select_user(borrowernumber, borrower) { Link Here
444
	            [% END %]
439
	            [% END %]
445
	        </li>
440
	        </li>
446
[% ELSE %]
441
[% ELSE %]
447
 [% IF ( C ) %]
448
 [% IF ( guarantorid ) %]
442
 [% IF ( guarantorid ) %]
449
 <li id="contact-details">
443
 <li id="contact-details">
450
 [% ELSE %]
444
 [% ELSE %]
Lines 462-470 function select_user(borrowernumber, borrower) { Link Here
462
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
456
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
463
     [% END %]
457
     [% END %]
464
 </li>
458
 </li>
465
        [% END %]
459
     [% UNLESS nocontactfirstname %]
466
        [% UNLESS nocontactfirstname %]
460
<li>
467
 <li>
468
     <label for="contactfirstname">First name: </label>
461
     <label for="contactfirstname">First name: </label>
469
     [% IF ( guarantorid ) %]
462
     [% IF ( guarantorid ) %]
470
     <span>[% contactfirstname %]</span>
463
     <span>[% contactfirstname %]</span>
Lines 1042-1047 function select_user(borrowernumber, borrower) { Link Here
1042
                <li data-category_code="[% patron_attribute.category_code %]">
1035
                <li data-category_code="[% patron_attribute.category_code %]">
1043
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1036
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1044
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1037
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1038
                        <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" />
1045
                        [% IF ( patron_attribute.use_dropdown ) %]
1039
                        [% IF ( patron_attribute.use_dropdown ) %]
1046
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1040
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1047
                                <option value=""></option>
1041
                                <option value=""></option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-13 / +18 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-253 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 ( guarantorborrowernumber ) %]
247
        <li>
253
        <li>
248
            <span class="label">Guarantor:</span>
254
            <span class="label">Guarantor:</span>
249
            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber %]">[% guarantor.firstname %] [% guarantor.surname %]</a>
255
            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorborrowernumber %]">[% IF ( guarantorfirstname ) %][% guarantorfirstname %], [% END %][% guarantorsurname %]</a></li>
250
        </li>
251
    [% END %]
256
    [% END %]
252
</ol>
257
</ol>
253
</div>
258
</div>
(-)a/members/memberentry.pl (-4 / +15 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::Borrower::Debarments;
43
use Koha::Patron::Categories;
42
use Koha::Patron::Debarments;
44
use Koha::Patron::Debarments;
43
use Koha::Cities;
45
use Koha::Cities;
44
use Koha::DateUtils;
46
use Koha::DateUtils;
Lines 237-244 if ( ( $op eq 'insert' ) and !$nodouble ) { Link Here
237
    }
239
    }
238
}
240
}
239
241
240
  #recover all data from guarantor address phone ,fax... 
242
#recover all data from guarantor address phone ,fax...
241
if ( $guarantorid ) {
243
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {
244
242
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
245
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
243
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
246
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
244
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
247
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
Lines 250-257 if ( $guarantorid ) { Link Here
250
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
253
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
251
                        B_streetnumber B_streettype B_address B_address2
254
                        B_streetnumber B_streettype B_address B_address2
252
                        B_city B_state B_zipcode B_country B_email B_phone)) {
255
                        B_city B_state B_zipcode B_country B_email B_phone)) {
253
		        $newdata{$_} = $guarantordata->{$_};
256
                        $newdata{$_} = $guarantordata->{$_};
254
	        }
257
	        }
258
            my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField");
259
            my @field_add=split(/\|/,$additionalGuarantorField);
260
            my $guarantordata=GetMember(borrowernumber => $guarantorid);
261
            foreach (@field_add) {
262
                $newdata{$_} = $guarantordata->{$_};
263
            }
255
        }
264
        }
256
    }
265
    }
257
}
266
}
Lines 662-668 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
662
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
671
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
663
}
672
}
664
673
665
$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
674
$template->param( "showguarantor"  => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are
675
676
$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
666
$debug and warn "memberentry step: $step";
677
$debug and warn "memberentry step: $step";
667
$template->param(%data);
678
$template->param(%data);
668
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
679
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
(-)a/members/moremember.pl (-4 / +37 lines)
Lines 166-177 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
} else {
171
} else {
173
    my @guarantees = $patron->guarantees;
172
    my @guarantees = $patron->guarantees;
174
    $template->param( guarantees => \@guarantees );
175
    push @relatives, $_->borrowernumber for @guarantees;
173
    push @relatives, $_->borrowernumber for @guarantees;
176
}
174
}
177
175
Lines 179-185 my $relatives_issues_count = Link Here
179
  Koha::Database->new()->schema()->resultset('Issue')
177
  Koha::Database->new()->schema()->resultset('Issue')
180
  ->count( { borrowernumber => \@relatives } );
178
  ->count( { borrowernumber => \@relatives } );
181
179
182
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' );
180
my ( $count, $guarantees ) = GetGuarantees( $data->{'borrowernumber'} );
181
if ( $count ) {
182
    $template->param( isguarantee => 1 );
183
184
    # FIXME
185
    # It looks like the $i is only being returned to handle walking through
186
    # the array, which is probably better done as a foreach loop.
187
    #
188
    my @guaranteedata;
189
    my $amount;
190
    my $totalmount = 0;
191
192
    for ( my $i = 0 ; $i < $count ; $i++ ) {
193
        my ($amount,$accts,undef) = GetMemberAccountRecords($guarantees->[$i]->{'borrowernumber'});
194
        push(@guaranteedata,
195
            {
196
                borrowernumber => $guarantees->[$i]->{'borrowernumber'},
197
                cardnumber     => $guarantees->[$i]->{'cardnumber'},
198
                finesguarantee => sprintf("%.2f",$amount),
199
                name           => $guarantees->[$i]->{'firstname'} . " "
200
                                . $guarantees->[$i]->{'surname'}
201
            }
202
        );
203
        $totalmount += $amount;
204
    }
205
    $template->param( guaranteeloop => \@guaranteedata );
206
    $template->param( amounttot => sprintf("%.2f",$totalmount));
207
}
208
( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
209
210
if ($data->{'guarantorid'}){
211
    my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
212
    $template->param(guarantor => 1);
213
    foreach (qw(borrowernumber cardnumber firstname surname)) {
214
          $template->param("guarantor$_" => $guarantor->{$_});
215
    }
216
}
183
217
184
my %bor;
218
my %bor;
185
$bor{'borrowernumber'} = $borrowernumber;
219
$bor{'borrowernumber'} = $borrowernumber;
186
- 

Return to bug 12446