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 383-388 sub _sort_by_code { Link Here
383
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
383
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
384
}
384
}
385
385
386
=head2 get_guarantor_shared_attributes
387
388
    $guarantor_attributes = get_guarantor_attributes();
389
390
    returns an array reference containing attributes to be shared between guarantor and guarantee.
391
392
=cut
393
394
sub get_guarantor_shared_attributes{
395
    my @attributes    = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax );
396
    if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){
397
        $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces
398
        @attributes = ( @attributes, @additional);
399
    }
400
    return \@attributes;
401
}
402
386
=head1 AUTHOR
403
=head1 AUTHOR
387
404
388
Koha Development Team <http://koha-community.org/>
405
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 303-310 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
303
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
303
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
304
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
304
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
305
  `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
305
  `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
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
306
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
307
  `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'.
307
  `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
  `canbeguarantee` tinyint(1) NOT NULL default '0'
308
  PRIMARY KEY  (`categorycode`),
309
  PRIMARY KEY  (`categorycode`),
309
  UNIQUE KEY `categorycode` (`categorycode`)
310
  UNIQUE KEY `categorycode` (`categorycode`)
310
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
311
) 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 %]" />
11
        <input type="text" id="streetnumber" name="streetnumber" size="5" value="[% streetnumber %]" />
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 %]" selected="selected">[% roadtype.lib %]</option>
28
            <option value="[% roadtype.authorised_value %]" selected="selected">[% roadtype.lib %]</option>
29
          [% ELSE %]
29
          [% ELSE %]
30
            <option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</option>
30
            <option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</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 %]" />
46
            <input type="text" id="address" name="address" size="35" value="[% address %]" />
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 %]" />
58
            <input type="text" id="address2" name="address2" size="35" value="[% address2 %]" />
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 %]" />
70
        <input type="text" id="city" name="city" size="20" value="[% city %]" />
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 %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]" selected="selected">
76
                <option value="[% c.city_zipcode %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]" selected="selected">
77
                [% ELSE %]
77
                [% ELSE %]
78
                <option value="[% c.city_zipcode %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]">
78
                <option value="[% c.city_zipcode %]|[% c.city_name %]|[% c.city_state %]|[% c.city_country %]">
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 %]" />
96
      <input type="text" name="state" id="state" size="20" value="[% state %]" />
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 %]" />
108
            <input type="text" name="zipcode" id="zipcode" size="10" value="[% zipcode %]" />
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 %]" />
120
        <input type="text" name="country" id="country" size="20" value="[% country %]" />
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 %]"><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 %]"><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 %]"><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 %]"><i class="fa fa-lock"></i> Change password</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+15 lines)
Lines 149-154 Link Here
149
                    </select>
149
                    </select>
150
                    <span class="required">Required</span>
150
                    <span class="required">Required</span>
151
                </li>
151
                </li>
152
                <li>
153
                    <label for="canbeguarantee">Can be guarantee</label>
154
                    <select name="canbeguarantee" id="canbeguarantee">
155
                        [% IF category.canbeguarantee %]
156
                            <option value="1" selected>Yes</option>
157
                            <option value="0">No</option>
158
                        [% ELSE %]
159
                            <option value="1">Yes</option>
160
                            <option value="0" selected>No</option>
161
                        [% END %]
162
                    <select>
163
                </li>
152
                <li><label for="branches">Branches limitation: </label>
164
                <li><label for="branches">Branches limitation: </label>
153
                    <select id="branches" name="branches" multiple size="10">
165
                    <select id="branches" name="branches" multiple size="10">
154
                        <option value="">All branches</option>
166
                        <option value="">All branches</option>
Lines 297-302 Link Here
297
                      </td>
309
                      </td>
298
                  </tr>
310
                  </tr>
299
                [% END %]
311
                [% END %]
312
                <tr><th scope="row">Can be guarantee</th><td>[% IF category.canbeguarantee %]Yes[% ELSE %]No[% END %]</td></tr>
300
                <tr>
313
                <tr>
301
                    <th scope="row">Default privacy: </th>
314
                    <th scope="row">Default privacy: </th>
302
                    <td>
315
                    <td>
Lines 356-361 Link Here
356
                    [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
369
                    [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
357
                    <th scope="col">Check previous checkout?</th>
370
                    <th scope="col">Check previous checkout?</th>
358
                    [% END %]
371
                    [% END %]
372
                    <th scope="col">Can be guarantee</th>
359
                    <th scope="col">Default privacy</th>
373
                    <th scope="col">Default privacy</th>
360
                    <th scope="col">Actions</th>
374
                    <th scope="col">Actions</th>
361
                </tr>
375
                </tr>
Lines 460-465 Link Here
460
                              [% END %]
474
                              [% END %]
461
                          </td>
475
                          </td>
462
                        [% END %]
476
                        [% END %]
477
                        <td>[% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %]</td>
463
                        <td>
478
                        <td>
464
                            [% SWITCH category.default_privacy %]
479
                            [% SWITCH category.default_privacy %]
465
                            [% CASE 'default' %]
480
                            [% CASE 'default' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+5 lines)
Lines 205-210 Patrons: Link Here
205
         - pref: FailedLoginAttempts
205
         - pref: FailedLoginAttempts
206
           class: integer
206
           class: integer
207
         - failed login attempts.
207
         - failed login attempts.
208
     -
209
         - "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:"
210
         - pref: AdditionalGuarantorField
211
           class: multi
212
         - (separate columns with |)
208
    "Norwegian patron database":
213
    "Norwegian patron database":
209
     -
214
     -
210
         - pref: NorwegianPatronDBEnable
215
         - pref: NorwegianPatronDBEnable
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt (-3 / +4 lines)
Lines 198-204 Link Here
198
                e.preventDefault();
198
                e.preventDefault();
199
                var borrowernumber = $(this).data("borrowernumber");
199
                var borrowernumber = $(this).data("borrowernumber");
200
                var borrower_data = $("#borrower_data"+borrowernumber).val();
200
                var borrower_data = $("#borrower_data"+borrowernumber).val();
201
                select_user( borrowernumber, JSON.parse(borrower_data) );
201
                var guarantor_attributes = $("#guarantor_attributes").val();
202
                select_user( borrowernumber, JSON.parse(borrower_data), JSON.parse(guarantor_attributes) );
202
            });
203
            });
203
204
204
        });
205
        });
Lines 244-252 Link Here
244
                wait_for_opener();
245
                wait_for_opener();
245
            }
246
            }
246
        [% ELSIF selection_type == 'select' %]
247
        [% ELSIF selection_type == 'select' %]
247
            function select_user(borrowernumber, data) {
248
            function select_user(borrowernumber, data, attributes) {
248
                var p = window.opener;
249
                var p = window.opener;
249
                p.select_user(borrowernumber, data);
250
                p.select_user(borrowernumber, data, attributes);
250
                window.close();
251
                window.close();
251
            }
252
            }
252
        [% END %]
253
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-4 / +2 lines)
Lines 314-320 Link Here
314
	            [% END %]
314
	            [% END %]
315
	        </li>
315
	        </li>
316
[% ELSE %]
316
[% ELSE %]
317
 [% IF ( C ) %]
318
 [% IF ( guarantorid ) %]
317
 [% IF ( guarantorid ) %]
319
 <li id="contact-details">
318
 <li id="contact-details">
320
 [% ELSE %]
319
 [% ELSE %]
Lines 339-347 Link Here
339
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
338
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
340
     [% END %]
339
     [% END %]
341
 </li>
340
 </li>
342
        [% END %]
341
     [% UNLESS nocontactfirstname %]
343
        [% UNLESS nocontactfirstname %]
342
<li>
344
 <li>
345
     <label for="contactfirstname">First name: </label>
343
     <label for="contactfirstname">First name: </label>
346
     [% IF ( guarantorid ) %]
344
     [% IF ( guarantorid ) %]
347
     <span>[% contactfirstname %]</span>
345
     <span>[% contactfirstname %]</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-4 / +11 lines)
Lines 148-162 Link Here
148
        [% IF guarantees %]
148
        [% IF guarantees %]
149
            <li>
149
            <li>
150
                <span class="label">Guarantees:</span>
150
                <span class="label">Guarantees:</span>
151
                <ul>
151
                <table>
152
                    [% FOREACH guarantee IN guarantees %]
152
                    [% FOREACH guarantee IN guarantees %]
153
                    <tr>
153
                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
154
                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
154
                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></li>
155
                            <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></td>
156
                            <td style='text-align:right'>[% guarantee.account.balance %]</td>
155
                        [% ELSE %]
157
                        [% ELSE %]
156
                            <li>[% guarantee.firstname | html %] [% guarantee.surname | html %]</li>
158
                            <td>[% guarantee.firstname | html %] [% guarantee.surname | html %]</t>
157
                        [% END %]
159
                        [% END %]
160
                    </tr>
158
                    [% END %]
161
                    [% END %]
159
                </ul>
162
                    [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
163
                       <td>Total</td>
164
                       <td style='text-align:right'>[% amounttot %]</td>
165
                    [% END %]
166
                </table>
160
            </li>
167
            </li>
161
        [% ELSIF guarantor %]
168
        [% ELSIF guarantor %]
162
            <li>
169
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt (-1 / +1 lines)
Lines 17-23 Link Here
17
                "dt_address":
17
                "dt_address":
18
                    "[% INCLUDE escape_address data=data %]",
18
                    "[% INCLUDE escape_address data=data %]",
19
                "dt_action":
19
                "dt_action":
20
                    "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber %]\" name=\"borrower_data[% data.borrowernumber %]\" value=\"[% To.json(data) | html %]\" />"
20
                    "<a href=\"#\" class=\"btn btn-mini select_user\" data-borrowernumber=\"[% data.borrowernumber %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber %]\" name=\"guarantor_data\" value=\"[% To.json(data) | html %]\" /><input type=\"hidden\" id=\"guarantor_attributes\" name=\"guarantor_attributes\" value=\"[% To.json(attributes) | html %]\" />"
21
            }[% UNLESS loop.last %],[% END %]
21
            }[% UNLESS loop.last %],[% END %]
22
        [% END %]
22
        [% END %]
23
    ]
23
    ]
(-)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 256-268 if ( $guarantorid ) { Link Here
256
        $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
256
        $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
257
        $newdata{'contactname'}     = $guarantordata->{'surname'};
257
        $newdata{'contactname'}     = $guarantordata->{'surname'};
258
        $newdata{'contacttitle'}    = $guarantordata->{'title'};
258
        $newdata{'contacttitle'}    = $guarantordata->{'title'};
259
259
        if ( $op eq 'add' ) {
260
        if ( $op eq 'add' ) {
260
	        foreach (qw(streetnumber address streettype address2
261
            my @attributes = @{C4::Members::Attributes::get_guarantor_shared_attributes()};
261
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
262
            foreach my $attribute (@attributes) {
262
                        B_streetnumber B_streettype B_address B_address2
263
                $newdata{$attribute} = $guarantordata->{$attribute};
263
                        B_city B_state B_zipcode B_country B_email B_phone)) {
264
            }
264
		        $newdata{$_} = $guarantordata->{$_};
265
	        }
266
        }
265
        }
267
    }
266
    }
268
}
267
}
Lines 743-749 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
743
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
742
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
744
}
743
}
745
744
746
$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
745
$template->param( "showguarantor"  => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are
746
747
$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
747
$debug and warn "memberentry step: $step";
748
$debug and warn "memberentry step: $step";
748
$template->param(%data);
749
$template->param(%data);
749
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
750
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
(-)a/members/moremember.pl (-4 / +25 lines)
Lines 71-77 use Koha::Token; Link Here
71
use vars qw($debug);
71
use vars qw($debug);
72
72
73
BEGIN {
73
BEGIN {
74
	$debug = $ENV{DEBUG} || 0;
74
       $debug = $ENV{DEBUG} || 0;
75
}
75
}
76
76
77
my $dbh = C4::Context->dbh;
77
my $dbh = C4::Context->dbh;
Lines 150-156 foreach (qw(dateenrolled dateexpiry dateofbirth)) { # FIXME This should be remov Link Here
150
}
150
}
151
151
152
for (qw(gonenoaddress lost borrowernotes)) {
152
for (qw(gonenoaddress lost borrowernotes)) {
153
	 $data->{$_} and $template->param(flagged => 1) and last;
153
        $data->{$_} and $template->param(flagged => 1) and last;
154
}
154
}
155
155
156
if ( $patron->is_debarred ) {
156
if ( $patron->is_debarred ) {
Lines 176-182 if ( $patron->is_child ) { Link Here
176
176
177
my @relatives;
177
my @relatives;
178
if ( my $guarantor = $patron->guarantor ) {
178
if ( my $guarantor = $patron->guarantor ) {
179
    $template->param( guarantor => $guarantor );
180
    push @relatives, $guarantor->borrowernumber;
179
    push @relatives, $guarantor->borrowernumber;
181
    push @relatives, $_->borrowernumber for $patron->siblings;
180
    push @relatives, $_->borrowernumber for $patron->siblings;
182
} elsif ( $patron->contactname || $patron->contactfirstname ) {
181
} elsif ( $patron->contactname || $patron->contactfirstname ) {
Lines 188-200 if ( my $guarantor = $patron->guarantor ) { Link Here
188
    );
187
    );
189
} else {
188
} else {
190
    my @guarantees = $patron->guarantees;
189
    my @guarantees = $patron->guarantees;
191
    $template->param( guarantees => \@guarantees );
192
    push @relatives, $_->borrowernumber for @guarantees;
190
    push @relatives, $_->borrowernumber for @guarantees;
193
}
191
}
194
192
195
my $relatives_issues_count =
193
my $relatives_issues_count =
196
  Koha::Database->new()->schema()->resultset('Issue')
194
  Koha::Database->new()->schema()->resultset('Issue')
197
  ->count( { borrowernumber => \@relatives } );
195
  ->count( { borrowernumber => \@relatives } );
196
my @guarantees = $patron->guarantees;
197
my $count = scalar @guarantees;
198
if ( $count ) {
199
    $template->param( isguarantee => 1 );
200
201
    my @guaranteedata;
202
    my $amount;
203
    my $totalmount = 0;
204
205
    foreach my $guarantee (@guarantees){
206
207
        $totalmount += $guarantee->account->balance;
208
209
    }
210
    $template->param( guarantees => @guarantees);
211
    $template->param( amounttot => sprintf("%.2f",$totalmount));
212
}
213
( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
214
215
if (my $guarantor = $patron->guarantor){
216
    $template->param(isguarantor => 1);
217
    $template->param(guarantor => $guarantor);
218
}
198
219
199
my %bor;
220
my %bor;
200
$bor{'borrowernumber'} = $borrowernumber;
221
$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