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 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
=cut
392
sub get_guarantor_shared_attributes{
393
    my @attributes    = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax );
394
    if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){
395
        $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces
396
        @attributes = ( @attributes, @additional);
397
    }
398
    return \@attributes;
399
}
400
386
=head1 AUTHOR
401
=head1 AUTHOR
387
402
388
Koha Development Team <http://koha-community.org/>
403
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 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/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 (-4 / +4 lines)
Lines 318-325 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
318
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
318
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
319
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
319
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
320
  `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
320
  `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
321
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
321
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
322
  `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'.
322
  `canbeguarantee` tinyint(1) NOT NULL default '0'
323
  PRIMARY KEY  (`categorycode`),
323
  PRIMARY KEY  (`categorycode`),
324
  UNIQUE KEY `categorycode` (`categorycode`)
324
  UNIQUE KEY `categorycode` (`categorycode`)
325
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
325
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Lines 885-891 CREATE TABLE `refund_lost_item_fee_rules` ( -- refund lost item fee rules tbale Link Here
885
--
885
--
886
886
887
DROP TABLE IF EXISTS `items`;
887
DROP TABLE IF EXISTS `items`;
888
CREATE TABLE `items` ( -- holdings/item information 
888
CREATE TABLE `items` ( -- holdings/item information
889
  `itemnumber` int(11) NOT NULL auto_increment, -- primary key and unique identifier added by Koha
889
  `itemnumber` int(11) NOT NULL auto_increment, -- primary key and unique identifier added by Koha
890
  `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
890
  `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record
891
  `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
891
  `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information
Lines 2218-2224 CREATE TABLE `userflags` ( Link Here
2218
--
2218
--
2219
2219
2220
DROP TABLE IF EXISTS `virtualshelves`;
2220
DROP TABLE IF EXISTS `virtualshelves`;
2221
CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves) 
2221
CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves)
2222
  `shelfnumber` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2222
  `shelfnumber` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha
2223
  `shelfname` varchar(255) default NULL, -- name of the list
2223
  `shelfname` varchar(255) default NULL, -- name of the list
2224
  `owner` int default NULL, -- foreign key linking to the borrowers table (using borrowernumber) for the creator of this list (changed from varchar(80) to int)
2224
  `owner` int default NULL, -- foreign key linking to the borrowers table (using borrowernumber) for the creator of this list (changed from varchar(80) to int)
(-)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 542-546 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
542
('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'),
544
('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'),
543
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
545
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
544
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
546
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
545
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
547
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
546
;
548
;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc (-1 / +1 lines)
Lines 8-14 Link Here
8
                    <label for="B_streetnumber">
8
                    <label for="B_streetnumber">
9
                [% END %]
9
                [% END %]
10
                Street Number: </label>
10
                Street Number: </label>
11
                <input type="text" id="B_address" name="B_streetnumber" size="5" value="[% B_streetnumber %]" />
11
                <input type="text" id="B_streetnumber" name="B_streetnumber" size="5" value="[% B_streetnumber %]" />
12
               [% IF ( mandatoryB_streetnumber ) %]<span class="required">Required</span>[% END %]
12
               [% IF ( mandatoryB_streetnumber ) %]<span class="required">Required</span>[% END %]
13
            </li>
13
            </li>
14
        [% END %]
14
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (-1 / +1 lines)
Lines 148-154 function searchToHold(){ Link Here
148
148
149
    [% IF ( CAN_user_borrowers ) %]
149
    [% IF ( CAN_user_borrowers ) %]
150
        [% IF ( adultborrower AND activeBorrowerRelationship ) %]
150
        [% IF ( adultborrower AND activeBorrowerRelationship ) %]
151
            <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>
151
            <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>
152
        [% END %]
152
        [% END %]
153
        [% IF ( CAN_user_borrowers ) %]
153
        [% IF ( CAN_user_borrowers ) %]
154
            <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>
154
            <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 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 446-451 Link Here
446
                              [% END %]
460
                              [% END %]
447
                          </td>
461
                          </td>
448
                        [% END %]
462
                        [% END %]
463
                        <td>[% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %]</td>
449
                        <td>
464
                        <td>
450
                            [% SWITCH category.default_privacy %]
465
                            [% SWITCH category.default_privacy %]
451
                            [% CASE 'default' %]
466
                            [% CASE 'default' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +5 lines)
Lines 179-185 Patrons: Link Here
179
               yes: Show
179
               yes: Show
180
               no: "Don't show"
180
               no: "Don't show"
181
         - "patron messaging setting on the OPAC (note: EnhancedMessagingPreferences must be enabled)."
181
         - "patron messaging setting on the OPAC (note: EnhancedMessagingPreferences must be enabled)."
182
182
     -
183
         - "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:"
184
         - pref: AdditionalGuarantorField
185
           class: multi
186
         - (separate columns with |)
183
    "Norwegian patron database":
187
    "Norwegian patron database":
184
     -
188
     -
185
         - pref: NorwegianPatronDBEnable
189
         - pref: NorwegianPatronDBEnable
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt (-3 / +4 lines)
Lines 112-118 $(document).ready(function(){ Link Here
112
        e.preventDefault();
112
        e.preventDefault();
113
        var borrowernumber = $(this).data("borrowernumber");
113
        var borrowernumber = $(this).data("borrowernumber");
114
        var guarantor_data = $("#guarantor_data"+borrowernumber).val();
114
        var guarantor_data = $("#guarantor_data"+borrowernumber).val();
115
        select_user( borrowernumber, JSON.parse(guarantor_data) );
115
        var guarantor_attributes = $("#guarantor_attributes").val();
116
        select_user( borrowernumber, JSON.parse(guarantor_data), JSON.parse(guarantor_attributes) );
116
    });
117
    });
117
118
118
});
119
});
Lines 159-167 function filterByFirstLetterSurname(letter) { Link Here
159
            wait_for_opener();
160
            wait_for_opener();
160
        }
161
        }
161
    [% ELSIF selection_type == 'select' %]
162
    [% ELSIF selection_type == 'select' %]
162
        function select_user(borrowernumber, data) {
163
        function select_user(borrowernumber, data, attributes) {
163
            var p = window.opener;
164
            var p = window.opener;
164
            p.select_user(borrowernumber, data);
165
            p.select_user(borrowernumber, data, attributes);
165
            window.close();
166
            window.close();
166
        }
167
        }
167
    [% END %]
168
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-4 / +3 lines)
Lines 398-404 $(document).ready(function() { Link Here
398
	            [% END %]
398
	            [% END %]
399
	        </li>
399
	        </li>
400
[% ELSE %]
400
[% ELSE %]
401
 [% IF ( C ) %]
402
 [% IF ( guarantorid ) %]
401
 [% IF ( guarantorid ) %]
403
 <li id="contact-details">
402
 <li id="contact-details">
404
 [% ELSE %]
403
 [% ELSE %]
Lines 416-424 $(document).ready(function() { Link Here
416
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
415
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
417
     [% END %]
416
     [% END %]
418
 </li>
417
 </li>
419
        [% END %]
418
     [% UNLESS nocontactfirstname %]
420
        [% UNLESS nocontactfirstname %]
419
<li>
421
 <li>
422
     <label for="contactfirstname">First name: </label>
420
     <label for="contactfirstname">First name: </label>
423
     [% IF ( guarantorid ) %]
421
     [% IF ( guarantorid ) %]
424
     <span>[% contactfirstname %]</span>
422
     <span>[% contactfirstname %]</span>
Lines 1021-1026 $(document).ready(function() { Link Here
1021
                <li data-category_code="[% patron_attribute.category_code %]">
1019
                <li data-category_code="[% patron_attribute.category_code %]">
1022
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1020
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1023
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1021
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1022
                        <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" />
1024
                        [% IF ( patron_attribute.use_dropdown ) %]
1023
                        [% IF ( patron_attribute.use_dropdown ) %]
1025
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1024
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1026
                                <option value=""></option>
1025
                                <option value=""></option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-11 / +17 lines)
Lines 210-216 function validate1(date) { Link Here
210
   [% title %] [% firstname %] [% END %] [% surname %] ([% cardnumber %])</h3>
210
   [% title %] [% firstname %] [% END %] [% surname %] ([% cardnumber %])</h3>
211
 <div class="yui-u first">
211
 <div class="yui-u first">
212
<div id="patron-information" style="padding : .5em;">
212
<div id="patron-information" style="padding : .5em;">
213
214
     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
213
     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
215
214
216
    <div class = "address">
215
    <div class = "address">
Lines 246-261 function validate1(date) { Link Here
246
    [% IF ( sex ) %]<li><span class="label">Gender:</span>
245
    [% IF ( sex ) %]<li><span class="label">Gender:</span>
247
    [% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
246
    [% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
248
    </li>[% END %][% END %]
247
    </li>[% END %][% END %]
249
    [% IF guarantees %]
248
    [% IF ( isguarantee ) %]
250
        <li>
249
        [% IF ( guaranteeloop ) %]
251
            <span class="label">Guarantees:</span>
250
            <li><span class="label">Guarantees:</span>
252
            <ul>
251
                <table>[% FOREACH guaranteeloo IN guaranteeloop %]
253
                [% FOREACH guarantee IN guarantees %]
252
                <tr>
254
                    <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname %] [% guarantee.surname %]</a></li>
253
                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %]</a></td>
255
                [% END %]
254
                    <td style='text-align:right'>[% guaranteeloo.finesguarantee %]</td>
256
            </ul>
255
                </tr>[% END %]
257
        </li>
256
                <tr>
258
    [% ELSIF guarantor %]
257
                    <td>Total</td>
258
                    <td style='text-align:right'>[% amounttot %]</td>
259
                </tr>
260
                </table>
261
            </li>
262
        [% END %]
263
    [% END %]
264
    [% IF ( isguarantor ) %]
259
        <li>
265
        <li>
260
            <span class="label">Guarantor:</span>
266
            <span class="label">Guarantor:</span>
261
            [% IF guarantor.borrowernumber %]
267
            [% IF guarantor.borrowernumber %]
(-)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-mini select_user\" data-borrowernumber=\"[% data.borrowernumber %]\">Select</a><input type=\"hidden\" id=\"guarantor_data[% data.borrowernumber %]\" name=\"guarantor_data\" value=\"[% To.json(data) | html %]\" />"
20
                    "<a href=\"#\" class=\"btn btn-mini select_user\" data-borrowernumber=\"[% data.borrowernumber %]\">Select</a><input type=\"hidden\" id=\"guarantor_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 (-18 / +5 lines)
Lines 182-188 function update_category_code(category_code) { Link Here
182
    $(mytables).find(" li[data-category_code='']").show();
182
    $(mytables).find(" li[data-category_code='']").show();
183
}
183
}
184
184
185
function select_user(borrowernumber, borrower) {
185
function select_user(borrowernumber, borrower, attributes) {
186
    var form = $('#entryform').get(0);
186
    var form = $('#entryform').get(0);
187
    if (form.guarantorid.value) {
187
    if (form.guarantorid.value) {
188
        $("#contact-details").find('a').remove();
188
        $("#contact-details").find('a').remove();
Lines 203-218 function select_user(borrowernumber, borrower) { Link Here
203
        .val(borrower.firstname)
203
        .val(borrower.firstname)
204
        .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
204
        .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
205
205
206
    form.streetnumber.value = borrower.streetnumber;
207
    form.address.value = borrower.address;
208
    form.address2.value = borrower.address2;
209
    form.city.value = borrower.city;
210
    form.state.value = borrower.state;
211
    form.zipcode.value = borrower.zipcode;
212
    form.country.value = borrower.country;
213
    form.branchcode.value = borrower.branchcode;
214
215
    form.guarantorsearch.value = LABEL_CHANGE;
206
    form.guarantorsearch.value = LABEL_CHANGE;
207
    for (var i = 0; i < attributes.length; i++) {
208
      var attribute = attributes[i];
209
      document.forms.entryform[attribute].value = borrower[attribute];
210
    }
216
211
217
    return 0;
212
    return 0;
218
}
213
}
Lines 351-362 $(document).ready(function(){ Link Here
351
        e.preventDefault();
346
        e.preventDefault();
352
    });
347
    });
353
    $('#floating-save').css( { bottom: parseInt( $('#floating-save').css('bottom') ) + $('#changelanguage').height() + 'px' } );
348
    $('#floating-save').css( { bottom: parseInt( $('#floating-save').css('bottom') ) + $('#changelanguage').height() + 'px' } );
354
    $('#qa-save').css( {
355
        bottom: parseInt( $('#qa-save').css('bottom') ) + $('#changelanguage').height() + 'px' ,
356
        "background-color": "rgba(185, 216, 217, 0.6)",
357
        "bottom": "3%",
358
        "position": "fixed",
359
        "right": "1%",
360
        "width": "150px",
361
    } );
362
});
349
});
(-)a/members/memberentry.pl (-4 / +14 lines)
Lines 39-44 use C4::Log; Link Here
39
use C4::Letters;
39
use C4::Letters;
40
use C4::Branch; # GetBranches
40
use C4::Branch; # GetBranches
41
use C4::Form::MessagingPreferences;
41
use C4::Form::MessagingPreferences;
42
use Koha::Patron::Categories;
42
use Koha::Patron::Debarments;
43
use Koha::Patron::Debarments;
43
use Koha::Cities;
44
use Koha::Cities;
44
use Koha::DateUtils;
45
use Koha::DateUtils;
Lines 235-242 if ( ( $op eq 'insert' ) and !$nodouble ) { Link Here
235
    }
236
    }
236
}
237
}
237
238
238
  #recover all data from guarantor address phone ,fax... 
239
#recover all data from guarantor address phone ,fax...
239
if ( $guarantorid ) {
240
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {
241
240
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
242
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
241
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
243
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
242
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
244
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
Lines 248-255 if ( $guarantorid ) { Link Here
248
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
250
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
249
                        B_streetnumber B_streettype B_address B_address2
251
                        B_streetnumber B_streettype B_address B_address2
250
                        B_city B_state B_zipcode B_country B_email B_phone)) {
252
                        B_city B_state B_zipcode B_country B_email B_phone)) {
251
		        $newdata{$_} = $guarantordata->{$_};
253
                        $newdata{$_} = $guarantordata->{$_};
252
	        }
254
	        }
255
            my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField");
256
            my @field_add=split(/\|/,$additionalGuarantorField);
257
            my $guarantordata=GetMember(borrowernumber => $guarantorid);
258
            foreach (@field_add) {
259
                $newdata{$_} = $guarantordata->{$_};
260
            }
253
        }
261
        }
254
    }
262
    }
255
}
263
}
Lines 660-666 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
660
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
668
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
661
}
669
}
662
670
663
$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
671
$template->param( "showguarantor"  => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are
672
673
$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
664
$debug and warn "memberentry step: $step";
674
$debug and warn "memberentry step: $step";
665
$template->param(%data);
675
$template->param(%data);
666
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
676
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
(-)a/members/moremember.pl (-3 / +30 lines)
Lines 166-172 if ( $category_type eq 'C') { Link Here
166
my $patron = Koha::Patrons->find($data->{borrowernumber});
166
my $patron = Koha::Patrons->find($data->{borrowernumber});
167
my @relatives;
167
my @relatives;
168
if ( my $guarantor = $patron->guarantor ) {
168
if ( my $guarantor = $patron->guarantor ) {
169
    $template->param( guarantor => $guarantor );
170
    push @relatives, $guarantor->borrowernumber;
169
    push @relatives, $guarantor->borrowernumber;
171
    push @relatives, $_->borrowernumber for $patron->siblings;
170
    push @relatives, $_->borrowernumber for $patron->siblings;
172
} elsif ( $patron->contactname || $patron->contactfirstname ) {
171
} elsif ( $patron->contactname || $patron->contactfirstname ) {
Lines 178-192 if ( my $guarantor = $patron->guarantor ) { Link Here
178
    );
177
    );
179
} else {
178
} else {
180
    my @guarantees = $patron->guarantees;
179
    my @guarantees = $patron->guarantees;
181
    $template->param( guarantees => \@guarantees );
182
    push @relatives, $_->borrowernumber for @guarantees;
180
    push @relatives, $_->borrowernumber for @guarantees;
183
}
181
}
184
182
185
my $relatives_issues_count =
183
my $relatives_issues_count =
186
  Koha::Database->new()->schema()->resultset('Issue')
184
  Koha::Database->new()->schema()->resultset('Issue')
187
  ->count( { borrowernumber => \@relatives } );
185
  ->count( { borrowernumber => \@relatives } );
186
my @guarantees = $patron->guarantees;
187
my $count = scalar @guarantees;
188
if ( $count ) {
189
    $template->param( isguarantee => 1 );
190
191
    my @guaranteedata;
192
    my $amount;
193
    my $totalmount = 0;
194
195
    foreach my $guarantee (@guarantees){
196
        my ($amount,$accts,undef) = GetMemberAccountRecords($guarantee->borrowernumber);
197
        push(@guaranteedata,
198
            {
199
                borrowernumber => $guarantee->borrowernumber,
200
                cardnumber     => $guarantee->cardnumber,
201
                finesguarantee => sprintf("%.2f",$amount),
202
                name           => $guarantee->firstname . " "
203
                                . $guarantee->surname
204
            }
205
        );
206
        $totalmount += $amount;
207
    }
208
    $template->param( guaranteeloop => \@guaranteedata );
209
    $template->param( amounttot => sprintf("%.2f",$totalmount));
210
}
211
( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
188
212
189
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' );
213
if (my $guarantor = $patron->guarantor){
214
	$template->param(isguarantor => 1);
215
    $template->param(guarantor => $guarantor);
216
}
190
217
191
my %bor;
218
my %bor;
192
$bor{'borrowernumber'} = $borrowernumber;
219
$bor{'borrowernumber'} = $borrowernumber;
(-)a/svc/members/search (-1 / +2 lines)
Lines 112-123 if ($has_permission) { Link Here
112
    $results->{iTotalDisplayRecords} = scalar( @patrons_with_permission );
112
    $results->{iTotalDisplayRecords} = scalar( @patrons_with_permission );
113
}
113
}
114
114
115
my @attributes = C4::Members::Attributes::get_guarantor_shared_attributes();
115
$template->param(
116
$template->param(
116
    sEcho => $sEcho,
117
    sEcho => $sEcho,
117
    iTotalRecords => $results->{iTotalRecords},
118
    iTotalRecords => $results->{iTotalRecords},
118
    iTotalDisplayRecords => $results->{iTotalDisplayRecords},
119
    iTotalDisplayRecords => $results->{iTotalDisplayRecords},
119
    aaData => $results->{patrons},
120
    aaData => $results->{patrons},
120
    selection_type => $selection_type,
121
    selection_type => $selection_type,
122
    attributes => @attributes
121
);
123
);
122
124
123
output_with_http_headers $input, $cookie, $template->output, 'json';
125
output_with_http_headers $input, $cookie, $template->output, 'json';
124
- 

Return to bug 12446