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

(-)a/C4/Members/Attributes.pm (-1 / +18 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 365-370 sub _sort_by_code { Link Here
365
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
365
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
366
}
366
}
367
367
368
=head2 get_guarantor_shared_attributes
369
370
    $guarantor_attributes = get_guarantor_attributes();
371
372
    returns an array reference containing attributes to be shared between guarantor and guarantee.
373
374
=cut
375
376
sub get_guarantor_shared_attributes{
377
    my @attributes    = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax );
378
    if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){
379
        $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces
380
        @attributes = ( @attributes, @additional);
381
    }
382
    return \@attributes;
383
}
384
368
=head1 AUTHOR
385
=head1 AUTHOR
369
386
370
Koha Development Team <http://koha-community.org/>
387
Koha Development Team <http://koha-community.org/>
(-)a/C4/Utils/DataTables/Members.pm (-7 / +25 lines)
Lines 2-7 package C4::Utils::DataTables::Members; Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use C4::Context;
4
use C4::Context;
5
use C4::Members;
6
use C4::Members::Attributes qw/get_guarantor_shared_attributes/;
5
use C4::Utils::DataTables;
7
use C4::Utils::DataTables;
6
use Koha::DateUtils;
8
use Koha::DateUtils;
7
use C4::Members::Attributes qw(SearchIdMatchingAttribute );
9
use C4::Members::Attributes qw(SearchIdMatchingAttribute );
Lines 56-68 sub search { Link Here
56
        }
58
        }
57
    }
59
    }
58
60
59
    my $select = "SELECT
61
    # If branches are independent and user is not superlibrarian
60
        borrowers.borrowernumber, borrowers.surname, borrowers.firstname,
62
    # The search has to be only on the user branch
61
        borrowers.streetnumber, borrowers.streettype, borrowers.address,
63
    if ( C4::Context::only_my_library ) {
62
        borrowers.address2, borrowers.city, borrowers.state, borrowers.zipcode,
64
        my $userenv = C4::Context->userenv;
63
        borrowers.country, cardnumber, borrowers.dateexpiry,
65
        $branchcode = $userenv->{'branch'};
64
        borrowers.borrowernotes, borrowers.branchcode, borrowers.email,
66
65
        borrowers.userid, borrowers.dateofbirth, borrowers.categorycode,
67
    }
68
69
    $dbh = C4::Context->dbh;
70
    my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode phone phonepro mobile fax email emailpro);
71
    if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){
72
        foreach my $item (@guarantor_attributes) {
73
             if (! grep {$_ eq $item} @columns) {
74
                 push @columns, $item;
75
            }
76
        }
77
    };
78
    my $borrowers_columns = "";
79
    foreach my $item (@columns) {
80
        $borrowers_columns .= "borrowers." . $item . ", ";
81
    }
82
83
    my $select = "SELECT " . $borrowers_columns . "
66
        categories.description AS category_description, categories.category_type,
84
        categories.description AS category_description, categories.category_type,
67
        branches.branchname";
85
        branches.branchname";
68
    my $from = "FROM borrowers
86
    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 161-166 __PACKAGE__->add_columns( Link Here
161
    default_value => -1,
167
    default_value => -1,
162
    is_nullable   => 0,
168
    is_nullable   => 0,
163
  },
169
  },
170
  "canbeguarantee",
171
  { data_type => "tinyint", default_value => 0, is_nullable => 0},
164
  "default_privacy",
172
  "default_privacy",
165
  {
173
  {
166
    data_type => "enum",
174
    data_type => "enum",
(-)a/admin/categories.pl (+3 lines)
Lines 93-98 elsif ( $op eq 'add_validate' ) { Link Here
93
    my $checkPrevCheckout = $input->param('checkprevcheckout');
93
    my $checkPrevCheckout = $input->param('checkprevcheckout');
94
    my $default_privacy = $input->param('default_privacy');
94
    my $default_privacy = $input->param('default_privacy');
95
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
95
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
96
    my $canbeguarantee = $input->param('canbeguarantee');
96
97
97
    my $is_a_modif = $input->param("is_a_modif");
98
    my $is_a_modif = $input->param("is_a_modif");
98
99
Lines 119-124 elsif ( $op eq 'add_validate' ) { Link Here
119
        $category->hidelostitems($hidelostitems);
120
        $category->hidelostitems($hidelostitems);
120
        $category->overduenoticerequired($overduenoticerequired);
121
        $category->overduenoticerequired($overduenoticerequired);
121
        $category->category_type($category_type);
122
        $category->category_type($category_type);
123
        $category->canbeguarantee($canbeguarantee);
122
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
124
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
123
        $category->checkprevcheckout($checkPrevCheckout);
125
        $category->checkprevcheckout($checkPrevCheckout);
124
        $category->default_privacy($default_privacy);
126
        $category->default_privacy($default_privacy);
Lines 145-150 elsif ( $op eq 'add_validate' ) { Link Here
145
            hidelostitems => $hidelostitems,
147
            hidelostitems => $hidelostitems,
146
            overduenoticerequired => $overduenoticerequired,
148
            overduenoticerequired => $overduenoticerequired,
147
            category_type => $category_type,
149
            category_type => $category_type,
150
            canbeguarantee => $canbeguarantee,
148
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
151
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
149
            checkprevcheckout => $checkPrevCheckout,
152
            checkprevcheckout => $checkPrevCheckout,
150
            default_privacy => $default_privacy,
153
            default_privacy => $default_privacy,
(-)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 304-311 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
304
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
304
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
305
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
305
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
306
  `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
306
  `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
307
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
307
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
308
  `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'.
308
  `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'.
309
  `canbeguarantee` tinyint(1) NOT NULL default '0'
309
  PRIMARY KEY  (`categorycode`),
310
  PRIMARY KEY  (`categorycode`),
310
  UNIQUE KEY `categorycode` (`categorycode`)
311
  UNIQUE KEY `categorycode` (`categorycode`)
311
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
312
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
(-)a/installer/data/mysql/sysprefs.sql (-1 / +3 lines)
Lines 6-12 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
('AddressFormat','us','us|de|fr','Choose format to display postal addresses', 'Choice'),
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'),
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'),
12
('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice'),
14
('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc (-9 / +9 lines)
Lines 8-14 Link Here
8
      <label for="streetnumber">
8
      <label for="streetnumber">
9
      [% END %]
9
      [% END %]
10
      Street number: </label>
10
      Street number: </label>
11
        <input type="text" id="streetnumber" name="streetnumber" size="5" value="[% patron.streetnumber | html %]" />
11
        <input type="text" id="streetnumber" name="streetnumber" size="5" value="[% streetnumber | html %]" />
12
[% IF ( mandatorystreetnumber ) %]<span class="required">Required</span>[% END %]
12
[% IF ( mandatorystreetnumber ) %]<span class="required">Required</span>[% END %]
13
    </li>
13
    </li>
14
        [% END %]
14
        [% END %]
Lines 24-30 Link Here
24
      <select name="streettype">
24
      <select name="streettype">
25
        <option value=""></option>
25
        <option value=""></option>
26
        [% FOR roadtype IN roadtypes %]
26
        [% FOR roadtype IN roadtypes %]
27
          [% IF roadtype.authorised_value == patron.streettype %]
27
          [% IF roadtype.authorised_value == streettype %]
28
            <option value="[% roadtype.authorised_value | html %]" selected="selected">[% roadtype.lib | html %]</option>
28
            <option value="[% roadtype.authorised_value | html %]" selected="selected">[% roadtype.lib | html %]</option>
29
          [% ELSE %]
29
          [% ELSE %]
30
            <option value="[% roadtype.authorised_value | html %]">[% roadtype.lib | html %]</option>
30
            <option value="[% roadtype.authorised_value | html %]">[% roadtype.lib | html %]</option>
Lines 43-49 Link Here
43
      <label for="address">
43
      <label for="address">
44
      [% END %]
44
      [% END %]
45
      Address: </label>
45
      Address: </label>
46
            <input type="text" id="address" name="address" size="35" value="[% patron.address | html %]" />
46
            <input type="text" id="address" name="address" size="35" value="[% address | html %]" />
47
      [% IF ( mandatoryaddress ) %]<span class="required">Required</span>[% END %]
47
      [% IF ( mandatoryaddress ) %]<span class="required">Required</span>[% END %]
48
    </li>
48
    </li>
49
        [% END %]
49
        [% END %]
Lines 55-61 Link Here
55
      <label for="address2">
55
      <label for="address2">
56
      [% END %]
56
      [% END %]
57
      Address 2: </label>
57
      Address 2: </label>
58
            <input type="text" id="address2" name="address2" size="35" value="[% patron.address2 | html %]" />
58
            <input type="text" id="address2" name="address2" size="35" value="[% address2 | html %]" />
59
      [% IF ( mandatoryaddress2 ) %]<span class="required">Required</span>[% END %]
59
      [% IF ( mandatoryaddress2 ) %]<span class="required">Required</span>[% END %]
60
    </li>
60
    </li>
61
        [% END %]
61
        [% END %]
Lines 67-78 Link Here
67
        <label for="city">
67
        <label for="city">
68
      [% END %]
68
      [% END %]
69
      City: </label>
69
      City: </label>
70
        <input type="text" id="city" name="city" size="20" value="[% patron.city | html %]" />
70
        <input type="text" id="city" name="city" size="20" value="[% city | html %]" />
71
        [% IF cities.count %]or choose
71
        [% IF cities.count %]or choose
72
        <select id="select_city" name="select_city">
72
        <select id="select_city" name="select_city">
73
            <option value="|||"></option>
73
            <option value="|||"></option>
74
            [% FOREACH c IN cities %]
74
            [% FOREACH c IN cities %]
75
                [% IF c.city_name == patron.city && c.city_state == patron.state && c.city_zipcode == patron.zipcode %]
75
                [% IF c.city_name == city && c.city_state == state && c.city_zipcode == zipcode %]
76
                <option value="[% c.city_zipcode | html %]|[% c.city_name | html %]|[% c.city_state | html %]|[% c.city_country | html %]" selected="selected">
76
                <option value="[% c.city_zipcode | html %]|[% c.city_name | html %]|[% c.city_state | html %]|[% c.city_country | html %]" selected="selected">
77
                [% ELSE %]
77
                [% ELSE %]
78
                <option value="[% c.city_zipcode | html %]|[% c.city_name | html %]|[% c.city_state | html %]|[% c.city_country | html %]">
78
                <option value="[% c.city_zipcode | html %]|[% c.city_name | html %]|[% c.city_state | html %]|[% c.city_country | html %]">
Lines 93-99 Link Here
93
        <label for="state">
93
        <label for="state">
94
      [% END %]
94
      [% END %]
95
      State: </label>
95
      State: </label>
96
      <input type="text" name="state" id="state" size="20" value="[% patron.state | html %]" />
96
      <input type="text" name="state" id="state" size="20" value="[% state | html %]" />
97
      [% IF ( mandatorystate ) %]<span class="required">Required</span>[% END %]
97
      [% IF ( mandatorystate ) %]<span class="required">Required</span>[% END %]
98
    </li>
98
    </li>
99
        [% END %]
99
        [% END %]
Lines 105-111 Link Here
105
        <label for="zipcode">
105
        <label for="zipcode">
106
      [% END %]
106
      [% END %]
107
      ZIP/Postal code: </label>
107
      ZIP/Postal code: </label>
108
            <input type="text" name="zipcode" id="zipcode" size="10" value="[% patron.zipcode | html %]" />
108
            <input type="text" name="zipcode" id="zipcode" size="10" value="[% zipcode | html %]" />
109
      [% IF ( mandatoryzipcode ) %]<span class="required">Required</span>[% END %]
109
      [% IF ( mandatoryzipcode ) %]<span class="required">Required</span>[% END %]
110
    </li>
110
    </li>
111
        [% END %]
111
        [% END %]
Lines 117-123 Link Here
117
        <label for="country">
117
        <label for="country">
118
      [% END %]
118
      [% END %]
119
      Country: </label>
119
      Country: </label>
120
        <input type="text" name="country" id="country" size="20" value="[% patron.country | html %]" />
120
        <input type="text" name="country" id="country" size="20" value="[% country | html %]" />
121
      [% IF ( mandatorycountry ) %]<span class="required">Required</span>[% END %]
121
      [% IF ( mandatorycountry ) %]<span class="required">Required</span>[% END %]
122
    </li>
122
    </li>
123
        [% END %]
123
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (-1 / +1 lines)
Lines 16-22 Link Here
16
16
17
    [% IF CAN_user_borrowers_edit_borrowers %]
17
    [% IF CAN_user_borrowers_edit_borrowers %]
18
        [% IF patron.is_adult AND Koha.Preference("borrowerRelationship") %]
18
        [% IF patron.is_adult AND Koha.Preference("borrowerRelationship") %]
19
            <a id="addchild" class="btn btn-default btn-sm" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% patron.borrowernumber | html %]"><i class="fa fa-plus"></i> Add child</a>
19
            <a id="addchild" class="btn btn-default btn-sm" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% patron.borrowernumber | html %]"><i class="fa fa-plus"></i> Add guarantee</a>
20
        [% END %]
20
        [% END %]
21
        [% IF CAN_user_borrowers_edit_borrowers %]
21
        [% IF CAN_user_borrowers_edit_borrowers %]
22
            <a id="changepassword" class="btn btn-default btn-sm" href="/cgi-bin/koha/members/member-password.pl?member=[% patron.borrowernumber | html %]"><i class="fa fa-lock"></i> Change password</a>
22
            <a id="changepassword" class="btn btn-default btn-sm" href="/cgi-bin/koha/members/member-password.pl?member=[% patron.borrowernumber | html %]"><i class="fa fa-lock"></i> Change password</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+15 lines)
Lines 151-156 Link Here
151
                    </select>
151
                    </select>
152
                    <span class="required">Required</span>
152
                    <span class="required">Required</span>
153
                </li>
153
                </li>
154
                <li>
155
                    <label for="canbeguarantee">Can be guarantee</label>
156
                    <select name="canbeguarantee" id="canbeguarantee">
157
                        [% IF category.canbeguarantee %]
158
                            <option value="1" selected>Yes</option>
159
                            <option value="0">No</option>
160
                        [% ELSE %]
161
                            <option value="1">Yes</option>
162
                            <option value="0" selected>No</option>
163
                        [% END %]
164
                    <select>
165
                </li>
154
                <li><label for="branches">Branches limitation: </label>
166
                <li><label for="branches">Branches limitation: </label>
155
                    <select id="branches" name="branches" multiple size="10">
167
                    <select id="branches" name="branches" multiple size="10">
156
                        <option value="">All branches</option>
168
                        <option value="">All branches</option>
Lines 299-304 Link Here
299
                      </td>
311
                      </td>
300
                  </tr>
312
                  </tr>
301
                [% END %]
313
                [% END %]
314
                <tr><th scope="row">Can be guarantee</th><td>[% IF category.canbeguarantee %]Yes[% ELSE %]No[% END %]</td></tr>
302
                <tr>
315
                <tr>
303
                    <th scope="row">Default privacy: </th>
316
                    <th scope="row">Default privacy: </th>
304
                    <td>
317
                    <td>
Lines 358-363 Link Here
358
                    [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
371
                    [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
359
                    <th scope="col">Check previous checkout?</th>
372
                    <th scope="col">Check previous checkout?</th>
360
                    [% END %]
373
                    [% END %]
374
                    <th scope="col">Can be guarantee</th>
361
                    <th scope="col">Default privacy</th>
375
                    <th scope="col">Default privacy</th>
362
                    <th scope="col">Actions</th>
376
                    <th scope="col">Actions</th>
363
                </tr>
377
                </tr>
Lines 462-467 Link Here
462
                              [% END %]
476
                              [% END %]
463
                          </td>
477
                          </td>
464
                        [% END %]
478
                        [% END %]
479
                        <td>[% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %]</td>
465
                        <td>
480
                        <td>
466
                            [% SWITCH category.default_privacy %]
481
                            [% SWITCH category.default_privacy %]
467
                            [% CASE 'default' %]
482
                            [% CASE 'default' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+6 lines)
Lines 213-218 Patrons: Link Here
213
               yes: Allow only superlibrarians
213
               yes: Allow only superlibrarians
214
               no: Allow all permitted users
214
               no: Allow all permitted users
215
         - "to access/change superlibrarian privileges. Note: A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
215
         - "to access/change superlibrarian privileges. Note: A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
216
    -
217
         - "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:"
218
         - pref: AdditionalGuarantorField
219
           class: multi
220
         - (separate columns with |)
221
216
    Privacy:
222
    Privacy:
217
     -
223
     -
218
         - Use the following URL
224
         - Use the following URL
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt (-3 / +4 lines)
Lines 197-203 Link Here
197
                e.preventDefault();
197
                e.preventDefault();
198
                var borrowernumber = $(this).data("borrowernumber");
198
                var borrowernumber = $(this).data("borrowernumber");
199
                var borrower_data = $("#borrower_data"+borrowernumber).val();
199
                var borrower_data = $("#borrower_data"+borrowernumber).val();
200
                select_user( borrowernumber, JSON.parse(borrower_data) );
200
                var guarantor_attributes = $("#guarantor_attributes").val();
201
                select_user( borrowernumber, JSON.parse(borrower_data), JSON.parse(guarantor_attributes) );
201
            });
202
            });
202
203
203
        });
204
        });
Lines 243-251 Link Here
243
                wait_for_opener();
244
                wait_for_opener();
244
            }
245
            }
245
        [% ELSIF selection_type == 'select' %]
246
        [% ELSIF selection_type == 'select' %]
246
            function select_user(borrowernumber, data) {
247
            function select_user(borrowernumber, data, attributes) {
247
                var p = window.opener;
248
                var p = window.opener;
248
                p.select_user(borrowernumber, data);
249
                p.select_user(borrowernumber, data, attributes);
249
                window.close();
250
                window.close();
250
            }
251
            }
251
        [% END %]
252
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-4 / +2 lines)
Lines 338-344 Link Here
338
	            [% END %]
338
	            [% END %]
339
	        </li>
339
	        </li>
340
[% ELSE %]
340
[% ELSE %]
341
 [% IF ( C ) %]
342
 [% IF ( guarantorid ) %]
341
 [% IF ( guarantorid ) %]
343
 <li id="contact-details">
342
 <li id="contact-details">
344
 [% ELSE %]
343
 [% ELSE %]
Lines 363-371 Link Here
363
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
362
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
364
     [% END %]
363
     [% END %]
365
 </li>
364
 </li>
366
        [% END %]
365
     [% UNLESS nocontactfirstname %]
367
        [% UNLESS nocontactfirstname %]
366
<li>
368
 <li>
369
     <label for="contactfirstname">First name: </label>
367
     <label for="contactfirstname">First name: </label>
370
     [% IF ( guarantorid ) %]
368
     [% IF ( guarantorid ) %]
371
     <span>[% contactfirstname | html %]</span>
369
     <span>[% contactfirstname | html %]</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-4 / +11 lines)
Lines 229-243 Link Here
229
                                        [% IF guarantees %]
229
                                        [% IF guarantees %]
230
                                            <li>
230
                                            <li>
231
                                                <span class="label">Guarantees:</span>
231
                                                <span class="label">Guarantees:</span>
232
                                                <ul>
232
                                                <table>
233
                                                    [% FOREACH guarantee IN guarantees %]
233
                                                    [% FOREACH guarantee IN guarantees %]
234
                                                    <tr>
234
                                                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
235
                                                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
235
                                                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber | html %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></li>
236
                                                            <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber | html %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></td>
237
                                                            <td style='text-align:right'>[% guarantee.account.balance %]</td>
236
                                                        [% ELSE %]
238
                                                        [% ELSE %]
237
                                                            <li>[% guarantee.firstname | html %] [% guarantee.surname | html %]</li>
239
                                                            <td>[% guarantee.firstname | html %] [% guarantee.surname | html %]</td>
238
                                                        [% END %]
240
                                                        [% END %]
241
                                                    </tr>
239
                                                    [% END %]
242
                                                    [% END %]
240
                                                </ul>
243
                                                    [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
244
                                                       <td>Total</td>
245
                                                       <td style='text-align:right'>[% amounttot %]</td>
246
                                                    [% END %]
247
                                                </table>
241
                                            </li>
248
                                            </li>
242
                                        [% ELSIF guarantor %]
249
                                        [% ELSIF guarantor %]
243
                                            <li>
250
                                            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt (-1 / +1 lines)
Lines 18-24 Link Here
18
                "dt_address":
18
                "dt_address":
19
                    "[% INCLUDE escape_address data=data %]",
19
                    "[% INCLUDE escape_address data=data %]",
20
                "dt_action":
20
                "dt_action":
21
                    "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"borrower_data[% data.borrowernumber | html %]\" value=\"[% To.json(data) | html %]\" />"
21
                    "<a href=\"#\" class=\"btn btn-mini select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"guarantor_data\" value=\"[% To.json(data) | html %]\" /><input type=\"hidden\" id=\"guarantor_attributes\" name=\"guarantor_attributes\" value=\"[% To.json(attributes) | html %]\" />"
22
            }[% UNLESS loop.last %],[% END %]
22
            }[% UNLESS loop.last %],[% END %]
23
        [% END %]
23
        [% END %]
24
    ]
24
    ]
(-)a/koha-tmpl/intranet-tmpl/prog/js/members.js (-12 / +8 lines)
Lines 169-175 function update_category_code(category_code) { Link Here
169
    $(mytables).find(" li[data-category_code='']").show();
169
    $(mytables).find(" li[data-category_code='']").show();
170
}
170
}
171
171
172
function select_user(borrowernumber, borrower) {
172
function select_user(borrowernumber, borrower, attributes) {
173
    var form = $('#entryform').get(0);
173
    var form = $('#entryform').get(0);
174
    if (form.guarantorid.value) {
174
    if (form.guarantorid.value) {
175
        $("#contact-details, #quick_add_form #contact-details").find('a').remove();
175
        $("#contact-details, #quick_add_form #contact-details").find('a').remove();
Lines 192-205 function select_user(borrowernumber, borrower) { Link Here
192
        .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
192
        .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
193
    $("#quick_add_form #contactfirstname").val(borrower.firstname).before('<span>'+borrower.firstname+'</span.').attr({type:"hidden"});
193
    $("#quick_add_form #contactfirstname").val(borrower.firstname).before('<span>'+borrower.firstname+'</span.').attr({type:"hidden"});
194
194
195
    form.streetnumber.value = borrower.streetnumber;
195
    form.guarantorsearch.value = LABEL_CHANGE;
196
    form.address.value = borrower.address;
196
    for (var i = 0; i < parseInt(attributes.length, 10); i++) {
197
    form.address2.value = borrower.address2;
197
        var attribute = attributes[i];
198
    form.city.value = borrower.city;
198
        if (borrower[attribute] != null){
199
    form.state.value = borrower.state;
199
            document.forms.entryform[attribute].value = borrower[attribute];
200
    form.zipcode.value = borrower.zipcode;
200
        }
201
    form.country.value = borrower.country;
201
    }
202
    form.branchcode.value = borrower.branchcode;
203
202
204
    $("#quick_add_form #streetnumber").val(borrower.streetnumber);
203
    $("#quick_add_form #streetnumber").val(borrower.streetnumber);
205
    $("#quick_add_form #address").val(borrower.address);
204
    $("#quick_add_form #address").val(borrower.address);
Lines 210-218 function select_user(borrowernumber, borrower) { Link Here
210
    $("#quick_add_form #country").val(borrower.country);
209
    $("#quick_add_form #country").val(borrower.country);
211
    $("#quick_add_form select[name='branchcode']").val(borrower.branchcode);
210
    $("#quick_add_form select[name='branchcode']").val(borrower.branchcode);
212
211
213
    form.guarantorsearch.value = LABEL_CHANGE;
214
    $("#quick_add_form #guarantorsearch").val(LABEL_CHANGE);
215
216
    return 0;
212
    return 0;
217
}
213
}
218
214
(-)a/members/memberentry.pl (-7 / +8 lines)
Lines 258-270 if ( $guarantorid ) { Link Here
258
        $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
258
        $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
259
        $newdata{'contactname'}     = $guarantordata->{'surname'};
259
        $newdata{'contactname'}     = $guarantordata->{'surname'};
260
        $newdata{'contacttitle'}    = $guarantordata->{'title'};
260
        $newdata{'contacttitle'}    = $guarantordata->{'title'};
261
261
        if ( $op eq 'add' ) {
262
        if ( $op eq 'add' ) {
262
	        foreach (qw(streetnumber address streettype address2
263
            my @attributes = @{C4::Members::Attributes::get_guarantor_shared_attributes()};
263
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
264
            foreach my $attribute (@attributes) {
264
                        B_streetnumber B_streettype B_address B_address2
265
                $newdata{$attribute} = $guarantordata->{$attribute};
265
                        B_city B_state B_zipcode B_country B_email B_phone)) {
266
            }
266
		        $newdata{$_} = $guarantordata->{$_};
267
	        }
268
        }
267
        }
269
    }
268
    }
270
}
269
}
Lines 758-764 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
758
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
757
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
759
}
758
}
760
759
761
$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
760
$template->param( "showguarantor"  => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are
761
762
$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
762
$debug and warn "memberentry step: $step";
763
$debug and warn "memberentry step: $step";
763
$template->param(%data);
764
$template->param(%data);
764
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
765
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
(-)a/members/moremember.pl (-4 / +25 lines)
Lines 67-73 use Koha::Token; Link Here
67
use vars qw($debug);
67
use vars qw($debug);
68
68
69
BEGIN {
69
BEGIN {
70
	$debug = $ENV{DEBUG} || 0;
70
       $debug = $ENV{DEBUG} || 0;
71
}
71
}
72
72
73
my $dbh = C4::Context->dbh;
73
my $dbh = C4::Context->dbh;
Lines 143-149 foreach (qw(dateenrolled dateexpiry dateofbirth)) { # FIXME This should be remov Link Here
143
}
143
}
144
144
145
for (qw(gonenoaddress lost borrowernotes)) {
145
for (qw(gonenoaddress lost borrowernotes)) {
146
	 $data->{$_} and $template->param(flagged => 1) and last;
146
        $data->{$_} and $template->param(flagged => 1) and last;
147
}
147
}
148
148
149
if ( $patron->is_debarred ) {
149
if ( $patron->is_debarred ) {
Lines 163-169 $data->{ "sex_".$data->{'sex'}."_p" } = 1 if defined $data->{sex}; Link Here
163
163
164
my @relatives;
164
my @relatives;
165
if ( my $guarantor = $patron->guarantor ) {
165
if ( my $guarantor = $patron->guarantor ) {
166
    $template->param( guarantor => $guarantor );
167
    push @relatives, $guarantor->borrowernumber;
166
    push @relatives, $guarantor->borrowernumber;
168
    push @relatives, $_->borrowernumber for $patron->siblings;
167
    push @relatives, $_->borrowernumber for $patron->siblings;
169
} elsif ( $patron->contactname || $patron->contactfirstname ) {
168
} elsif ( $patron->contactname || $patron->contactfirstname ) {
Lines 175-187 if ( my $guarantor = $patron->guarantor ) { Link Here
175
    );
174
    );
176
} else {
175
} else {
177
    my @guarantees = $patron->guarantees;
176
    my @guarantees = $patron->guarantees;
178
    $template->param( guarantees => \@guarantees );
179
    push @relatives, $_->borrowernumber for @guarantees;
177
    push @relatives, $_->borrowernumber for @guarantees;
180
}
178
}
181
179
182
my $relatives_issues_count =
180
my $relatives_issues_count =
183
  Koha::Database->new()->schema()->resultset('Issue')
181
  Koha::Database->new()->schema()->resultset('Issue')
184
  ->count( { borrowernumber => \@relatives } );
182
  ->count( { borrowernumber => \@relatives } );
183
my @guarantees = $patron->guarantees;
184
my $count = scalar @guarantees;
185
if ( $count ) {
186
    $template->param( isguarantee => 1 );
187
188
    my @guaranteedata;
189
    my $amount;
190
    my $totalmount = 0;
191
192
    foreach my $guarantee (@guarantees){
193
194
        $totalmount += $guarantee->account->balance;
195
196
    }
197
    $template->param( guarantees => @guarantees);
198
    $template->param( amounttot => sprintf("%.2f",$totalmount));
199
}
200
( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
201
202
if (my $guarantor = $patron->guarantor){
203
    $template->param(isguarantor => 1);
204
    $template->param(guarantor => $guarantor);
205
}
185
206
186
my %bor;
207
my %bor;
187
$bor{'borrowernumber'} = $borrowernumber;
208
$bor{'borrowernumber'} = $borrowernumber;
(-)a/svc/members/search (-1 / +2 lines)
Lines 109-120 if ($has_permission) { Link Here
109
    $results->{iTotalDisplayRecords} = scalar( @patrons_with_permission );
109
    $results->{iTotalDisplayRecords} = scalar( @patrons_with_permission );
110
}
110
}
111
111
112
my @attributes = C4::Members::Attributes::get_guarantor_shared_attributes();
112
$template->param(
113
$template->param(
113
    sEcho => $sEcho,
114
    sEcho => $sEcho,
114
    iTotalRecords => $results->{iTotalRecords},
115
    iTotalRecords => $results->{iTotalRecords},
115
    iTotalDisplayRecords => $results->{iTotalDisplayRecords},
116
    iTotalDisplayRecords => $results->{iTotalDisplayRecords},
116
    aaData => $results->{patrons},
117
    aaData => $results->{patrons},
117
    selection_type => $selection_type,
118
    selection_type => $selection_type,
119
    attributes => @attributes
118
);
120
);
119
121
120
output_with_http_headers $input, $cookie, $template->output, 'json';
122
output_with_http_headers $input, $cookie, $template->output, 'json';
121
- 

Return to bug 12446