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

(-)a/C4/Category.pm (+34 lines)
Lines 94-99 sub all { Link Here
94
    };
94
    };
95
}
95
}
96
96
97
=head3 C4::Category->get
98
99
    $cat = get( $category_code );
100
    This returns the category as an object.
101
102
=cut
103
104
sub get {
105
    my ( $class, $code ) = @_;
106
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
107
    my $dbh = C4::Context->dbh;
108
109
    my ( $query , @params );
110
    if( $branch_limit ){
111
        $query = qq| SELECT categories.* FROM categories
112
                     LEFT JOIN categories_branches ON categories_branches.categorycode = categories.categorycode
113
                     WHERE categories.categorycode = ? AND (categories_branches.branchcode = ? OR categories_branches.branchcode IS NULL)
114
                    |;
115
        @params = ( $code, $branch_limit );
116
    }
117
    else{
118
       $query = "SELECT categories.* FROM categories WHERE categorycode = ?";
119
       @params = ( $code );
120
    }
121
122
    my $data = $dbh->selectrow_hashref( $query, undef, @params );
123
124
    return $class->new($data);
125
}
126
97
127
98
128
99
129
Lines 149-154 These are read-only accessors for attributes of a C4::Category object. Link Here
149
179
150
=cut
180
=cut
151
181
182
=head3 $category->canbeguarantee
183
184
=cut
185
152
sub AUTOLOAD {
186
sub AUTOLOAD {
153
    my $self = shift;
187
    my $self = shift;
154
    my $attr = $AUTOLOAD;
188
    my $attr = $AUTOLOAD;
(-)a/C4/Members/Attributes.pm (-1 / +16 lines)
Lines 34-40 BEGIN { Link Here
34
    @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes
34
    @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes
35
                    DeleteBorrowerAttribute UpdateBorrowerAttribute
35
                    DeleteBorrowerAttribute UpdateBorrowerAttribute
36
                    extended_attributes_code_value_arrayref extended_attributes_merge
36
                    extended_attributes_code_value_arrayref extended_attributes_merge
37
                    SearchIdMatchingAttribute);
37
                    SearchIdMatchingAttribute get_guarantor_shared_attributes);
38
    %EXPORT_TAGS = ( all => \@EXPORT_OK );
38
    %EXPORT_TAGS = ( all => \@EXPORT_OK );
39
}
39
}
40
40
Lines 357-362 sub _sort_by_code { Link Here
357
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
357
    return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value};
358
}
358
}
359
359
360
=head2 get_guarantor_shared_attributes
361
362
    $guarantor_attributes = get_guarantor_attributes();
363
364
    returns an array reference containing attributes to be shared between guarantor and guarantee.
365
=cut
366
sub get_guarantor_shared_attributes{
367
    my @attributes    = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax );
368
    if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){
369
        $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces
370
        @attributes = ( @attributes, @additional);
371
    }
372
    return \@attributes;
373
}
374
360
=head1 AUTHOR
375
=head1 AUTHOR
361
376
362
Koha Development Team <http://koha-community.org/>
377
Koha Development Team <http://koha-community.org/>
(-)a/C4/Utils/DataTables/Members.pm (-7 / +9 lines)
Lines 3-8 package C4::Utils::DataTables::Members; Link Here
3
use C4::Branch qw/onlymine/;
3
use C4::Branch qw/onlymine/;
4
use C4::Context;
4
use C4::Context;
5
use C4::Members qw/GetMemberIssuesAndFines/;
5
use C4::Members qw/GetMemberIssuesAndFines/;
6
use C4::Members::Attributes qw/get_guarantor_shared_attributes/;
6
use C4::Utils::DataTables;
7
use C4::Utils::DataTables;
7
use Modern::Perl;
8
use Modern::Perl;
8
9
Lines 31-43 sub search { Link Here
31
    }
32
    }
32
33
33
    my $dbh = C4::Context->dbh;
34
    my $dbh = C4::Context->dbh;
34
    my $select = "SELECT
35
    my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode );
35
        borrowers.borrowernumber, borrowers.surname, borrowers.firstname,
36
    if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){
36
        borrowers.streetnumber, borrowers.streettype, borrowers.address,
37
        my %seen = ();
37
        borrowers.address2, borrowers.city, borrowers.state, borrowers.zipcode,
38
        @columns = grep { ! $seen{ $_ }++ } ( @columns, @guarantor_attributes );
38
        borrowers.country, cardnumber, borrowers.dateexpiry,
39
    };
39
        borrowers.borrowernotes, borrowers.branchcode, borrowers.email,
40
    $_ = "borrowers.".$dbh->quote_identifier($_) for (@columns);
40
        borrowers.userid, borrowers.dateofbirth, borrowers.categorycode,
41
42
    my $select = "SELECT ${ \join(',', @columns) },
41
        categories.description AS category_description, categories.category_type,
43
        categories.description AS category_description, categories.category_type,
42
        branches.branchname";
44
        branches.branchname";
43
    my $from = "FROM borrowers
45
    my $from = "FROM borrowers
(-)a/admin/categorie.pl (-6 / +8 lines)
Lines 154-159 if ( $op eq 'add_form' ) { Link Here
154
          $data->{'BlockExpiredPatronOpacActions'},
154
          $data->{'BlockExpiredPatronOpacActions'},
155
        TalkingTechItivaPhone =>
155
        TalkingTechItivaPhone =>
156
          C4::Context->preference("TalkingTechItivaPhoneNotification"),
156
          C4::Context->preference("TalkingTechItivaPhoneNotification"),
157
        canbeguarantee       => $data->{'canbeguarantee'},
157
    );
158
    );
158
159
159
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
160
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
Lines 178-184 elsif ( $op eq 'add_validate' ) { Link Here
178
            )
179
            )
179
        );
180
        );
180
    }
181
    }
181
182
    if ($is_a_modif) {
182
    if ($is_a_modif) {
183
        my $sth = $dbh->prepare( "
183
        my $sth = $dbh->prepare( "
184
                UPDATE categories
184
                UPDATE categories
Lines 193-199 elsif ( $op eq 'add_validate' ) { Link Here
193
                    overduenoticerequired=?,
193
                    overduenoticerequired=?,
194
                    category_type=?,
194
                    category_type=?,
195
                    BlockExpiredPatronOpacActions=?,
195
                    BlockExpiredPatronOpacActions=?,
196
                    default_privacy=?
196
                    default_privacy=?,
197
                    canbeguarantee=?
197
                WHERE categorycode=?"
198
                WHERE categorycode=?"
198
        );
199
        );
199
        $sth->execute(
200
        $sth->execute(
Lines 204-210 elsif ( $op eq 'add_validate' ) { Link Here
204
                'reservefee',            'hidelostitems',
205
                'reservefee',            'hidelostitems',
205
                'overduenoticerequired', 'category_type',
206
                'overduenoticerequired', 'category_type',
206
                'block_expired',         'default_privacy',
207
                'block_expired',         'default_privacy',
207
                'categorycode'
208
                'canbeguarantee', 'categorycode'
208
            )
209
            )
209
        );
210
        );
210
        $sth->finish;
211
        $sth->finish;
Lines 224-230 elsif ( $op eq 'add_validate' ) { Link Here
224
                overduenoticerequired,
225
                overduenoticerequired,
225
                category_type,
226
                category_type,
226
                BlockExpiredPatronOpacActions,
227
                BlockExpiredPatronOpacActions,
227
                default_privacy
228
                default_privacy,
229
                canbeguarantee
228
            )
230
            )
229
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" );
231
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" );
230
        my $inserted = $sth->execute(
232
        my $inserted = $sth->execute(
Lines 235-241 elsif ( $op eq 'add_validate' ) { Link Here
235
                'enrolmentfee',    'reservefee',
237
                'enrolmentfee',    'reservefee',
236
                'hidelostitems',   'overduenoticerequired',
238
                'hidelostitems',   'overduenoticerequired',
237
                'category_type',   'block_expired',
239
                'category_type',   'block_expired',
238
                'default_privacy',
240
                'default_privacy', 'canbeguarantee'
239
            )
241
            )
240
        );
242
        );
241
        if ( $inserted ) {
243
        if ( $inserted ) {
Lines 340-346 if ( $op eq 'list' ) { Link Here
340
        }
342
        }
341
343
342
        $results->[$i]{'category_type'} //= '';
344
        $results->[$i]{'category_type'} //= '';
343
344
        my %row = (
345
        my %row = (
345
            branches              => \@selected_branches,
346
            branches              => \@selected_branches,
346
            categorycode          => $results->[$i]{'categorycode'},
347
            categorycode          => $results->[$i]{'categorycode'},
Lines 354-359 if ( $op eq 'list' ) { Link Here
354
            hidelostitems         => $results->[$i]{'hidelostitems'},
355
            hidelostitems         => $results->[$i]{'hidelostitems'},
355
            category_type         => $results->[$i]{'category_type'},
356
            category_type         => $results->[$i]{'category_type'},
356
            default_privacy       => $results->[$i]{'default_privacy'},
357
            default_privacy       => $results->[$i]{'default_privacy'},
358
            canbeguarantee       => $results->[$i]{'canbeguarantee'},
357
            reservefee => sprintf( "%.2f", $results->[$i]{'reservefee'} || 0 ),
359
            reservefee => sprintf( "%.2f", $results->[$i]{'reservefee'} || 0 ),
358
            enrolmentfee =>
360
            enrolmentfee =>
359
              sprintf( "%.2f", $results->[$i]{'enrolmentfee'} || 0 ),
361
              sprintf( "%.2f", $results->[$i]{'enrolmentfee'} || 0 ),
(-)a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql (+13 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
12
-- Set defaults for new column
13
UPDATE categories set canbeguarantee = 1 WHERE category_type IN ('C', 'P');
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 488-494 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
488
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
488
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
489
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
489
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
490
  `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
490
  `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
491
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
491
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
492
  `canbeguarantee` tinyint(1) NOT NULL default '0'
492
  PRIMARY KEY  (`categorycode`),
493
  PRIMARY KEY  (`categorycode`),
493
  UNIQUE KEY `categorycode` (`categorycode`)
494
  UNIQUE KEY `categorycode` (`categorycode`)
494
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
495
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
(-)a/installer/data/mysql/sysprefs.sql (-1 / +3 lines)
Lines 6-11 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
6
('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
6
('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
7
('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'),
7
('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'),
8
('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
8
('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
9
('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'),
10
('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'),
9
('AddressFormat','us','','Choose format to display postal addresses', 'Choice'),
11
('AddressFormat','us','','Choose format to display postal addresses', 'Choice'),
10
('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'),
12
('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'),
11
('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea'),
13
('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea'),
Lines 479-483 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
479
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
481
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
480
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
482
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
481
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
483
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
482
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
484
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
483
;
485
;
(-)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 %]&amp;category_type=C"><i class="icon-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 guarantiee</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="icon-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="icon-lock"></i> Change password</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (+19 lines)
Lines 24-29 Link Here
24
    if ( $("#branches option:selected").length < 1 ) {
24
    if ( $("#branches option:selected").length < 1 ) {
25
        $("#branches option:first").attr("selected", "selected");
25
        $("#branches option:first").attr("selected", "selected");
26
    }
26
    }
27
    $("#category_type").change(function(){
28
        var selected = $(this).val();
29
        $("#canbeguarantee").val( (selected == 'C' || selected == 'P') ? "1" : "0" );
30
    });
27
});
31
});
28
	function isNotNull(f,noalert) {
32
	function isNotNull(f,noalert) {
29
		if (f.value.length ==0) {
33
		if (f.value.length ==0) {
Lines 197-202 Link Here
197
					</select>
201
					</select>
198
        <span class="required">Required</span>
202
        <span class="required">Required</span>
199
    </li>
203
    </li>
204
    <li>
205
        <label for="canbeguarantee">Can be guarantee</label>
206
        <select name="canbeguarantee" id="canbeguarantee">
207
            [% IF canbeguarantee %]
208
                <option value="1" selected>Yes</option>
209
                <option value="0">No</option>
210
            [% ELSE %]
211
                <option value="1">Yes</option>
212
                <option value="0" selected>No</option>
213
            [% END %]
214
        <select>
215
    </li>
200
    <li><label for="branches">Branches limitation: </label>
216
    <li><label for="branches">Branches limitation: </label>
201
        <select id="branches" name="branches" multiple size="10">
217
        <select id="branches" name="branches" multiple size="10">
202
            <option value="">All branches</option>
218
            <option value="">All branches</option>
Lines 299-304 Link Here
299
	<tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
315
	<tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
300
	<tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
316
	<tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
301
	<tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
317
	<tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
318
    <tr><th scope="row">Can be guarantee</th><td>[% IF ( canbeguarantee ) %]Yes[% ELSE %]No[% END %]</td></tr>
302
    <tr>
319
    <tr>
303
        <th scope="row">Default privacy: </th>
320
        <th scope="row">Default privacy: </th>
304
        <td>
321
        <td>
Lines 351-356 Link Here
351
            <th scope="col">Messaging</th>
368
            <th scope="col">Messaging</th>
352
            [% END %]
369
            [% END %]
353
            <th scope="col">Branches limitations</th>
370
            <th scope="col">Branches limitations</th>
371
            <th scope="col">Can be guarantee</th>
354
            <th scope="col">Default privacy</th>
372
            <th scope="col">Default privacy</th>
355
            <th scope="col">&nbsp; </th>
373
            <th scope="col">&nbsp; </th>
356
            <th scope="col">&nbsp; </th>
374
            <th scope="col">&nbsp; </th>
Lines 425-430 Link Here
425
                                No limitation
443
                                No limitation
426
                            [% END %]
444
                            [% END %]
427
                        </td>
445
                        </td>
446
                        <td>[% IF loo.canbeguarantee %]Yes[% ELSE %]No[% END %]</td>
428
                        <td>
447
                        <td>
429
                            [% SWITCH loo.default_privacy %]
448
                            [% SWITCH loo.default_privacy %]
430
                            [% CASE 'default' %]
449
                            [% CASE 'default' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+5 lines)
Lines 138-143 Patrons: Link Here
138
               yes: Allow
138
               yes: Allow
139
               no: "Don't allow"
139
               no: "Don't allow"
140
         - librarians to discharge borrowers and borrowers to request a discharge.
140
         - librarians to discharge borrowers and borrowers to request a discharge.
141
     -
142
         - "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:"
143
         - pref: AdditionalGuarantorField
144
           class: multi
145
         - (separate columns with |)
141
    "Norwegian patron database":
146
    "Norwegian patron database":
142
     -
147
     -
143
         - pref: NorwegianPatronDBEnable
148
         - pref: NorwegianPatronDBEnable
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-12 / +6 lines)
Lines 120-133 Link Here
120
            .val(borrower.firstname)
120
            .val(borrower.firstname)
121
            .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
121
            .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
122
122
123
        form.streetnumber.value = borrower.streetnumber;
123
        [% FOREACH field IN guarantor_attributes %]
124
        form.address.value = borrower.address;
124
            $(form.[% field %]).val(borrower.[% field %]);
125
        form.address2.value = borrower.address2;
125
        [% END %]
126
        form.city.value = borrower.city;
127
        form.state.value = borrower.state;
128
        form.zipcode.value = borrower.zipcode;
129
        form.country.value = borrower.country;
130
        form.branchcode.value = borrower.branchcode;
131
126
132
        form.guarantorsearch.value = 'Change';
127
        form.guarantorsearch.value = 'Change';
133
128
Lines 410-416 Link Here
410
	            [% END %]
405
	            [% END %]
411
	        </li>
406
	        </li>
412
[% ELSE %]
407
[% ELSE %]
413
 [% IF ( C ) %]
414
 [% IF ( guarantorid ) %]
408
 [% IF ( guarantorid ) %]
415
 <li id="contact-details">
409
 <li id="contact-details">
416
 [% ELSE %]
410
 [% ELSE %]
Lines 428-436 Link Here
428
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
422
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
429
     [% END %]
423
     [% END %]
430
 </li>
424
 </li>
431
        [% END %]
425
     [% UNLESS nocontactfirstname %]
432
        [% UNLESS nocontactfirstname %]
426
<li>
433
 <li>
434
     <label for="contactfirstname">First name: </label>
427
     <label for="contactfirstname">First name: </label>
435
     [% IF ( guarantorid ) %]
428
     [% IF ( guarantorid ) %]
436
     <span>[% contactfirstname %]</span>
429
     <span>[% contactfirstname %]</span>
Lines 982-987 Link Here
982
                <li data-category_code="[% patron_attribute.category_code %]">
975
                <li data-category_code="[% patron_attribute.category_code %]">
983
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
976
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
984
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
977
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
978
                        <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" />
985
                        [% IF ( patron_attribute.use_dropdown ) %]
979
                        [% IF ( patron_attribute.use_dropdown ) %]
986
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
980
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
987
                                <option value=""></option>
981
                                <option value=""></option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-3 / +14 lines)
Lines 235-247 function validate1(date) { Link Here
235
    [% END %]
235
    [% END %]
236
    [% IF ( isguarantee ) %]
236
    [% IF ( isguarantee ) %]
237
        [% IF ( guaranteeloop ) %]
237
        [% IF ( guaranteeloop ) %]
238
            <li><span class="label">Guarantees:</span><ul>[% FOREACH guaranteeloo IN guaranteeloop %]<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %]  </a></li>[% END %]</ul></li>
238
            <li><span class="label">Guarantees:</span>
239
                <table>[% FOREACH guaranteeloo IN guaranteeloop %]
240
                <tr>
241
                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %]</a></td>
242
                    <td style='text-align:right'>[% guaranteeloo.finesguarantee %] $</td>
243
                </tr>[% END %]
244
                <tr>
245
                    <td>Total</td>
246
                    <td style='text-align:right'>[% amounttot %] $</td>
247
                </tr>
248
                </table>
249
            </li>
239
        [% END %]
250
        [% END %]
240
    [% ELSE %]
251
    [% END %]
241
        [% IF ( guarantorborrowernumber ) %]
252
        [% IF ( guarantorborrowernumber ) %]
242
            <li><span class="label">Guarantor:</span><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorborrowernumber %]">[% guarantorsurname %][%IF ( guarantorfirstname ) %], [% guarantorfirstname %] [% END %]</a></li>
253
            <li><span class="label">Guarantor:</span><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorborrowernumber %]">[% guarantorsurname %][%IF ( guarantorfirstname ) %], [% guarantorfirstname %] [% END %]</a></li>
243
        [% END %]
254
        [% END %]
244
    [% END %]
255
245
</ol>
256
</ol>
246
</div>
257
</div>
247
      <div class="action">
258
      <div class="action">
(-)a/members/memberentry.pl (-5 / +11 lines)
Lines 41-46 use C4::Log; Link Here
41
use C4::Letters;
41
use C4::Letters;
42
use C4::Branch; # GetBranches
42
use C4::Branch; # GetBranches
43
use C4::Form::MessagingPreferences;
43
use C4::Form::MessagingPreferences;
44
use C4::Category;
44
use Koha::Borrower::Debarments;
45
use Koha::Borrower::Debarments;
45
use Koha::DateUtils;
46
use Koha::DateUtils;
46
use Module::Load;
47
use Module::Load;
Lines 250-256 if ( ( $op eq 'insert' ) and !$nodouble ) { Link Here
250
}
251
}
251
252
252
  #recover all data from guarantor address phone ,fax... 
253
  #recover all data from guarantor address phone ,fax... 
253
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) {
254
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {
254
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
255
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
255
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
256
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
256
        $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
257
        $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
Lines 258-268 if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) { Link Here
258
        $newdata{'contacttitle'}    = $guarantordata->{'title'};
259
        $newdata{'contacttitle'}    = $guarantordata->{'title'};
259
        if ( $op eq 'add' ) {
260
        if ( $op eq 'add' ) {
260
	        foreach (qw(streetnumber address streettype address2
261
	        foreach (qw(streetnumber address streettype address2
261
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
262
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode)) {
262
                        B_streetnumber B_streettype B_address B_address2
263
                        B_city B_state B_zipcode B_country B_email B_phone)) {
264
		        $newdata{$_} = $guarantordata->{$_};
263
		        $newdata{$_} = $guarantordata->{$_};
265
	        }
264
	        }
265
            my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField");
266
            my @field_add=split(/\|/,$additionalGuarantorField);
267
            my $guarantordata=GetMember(borrowernumber => $guarantorid);
268
            foreach (@field_add) {
269
                $newdata{$_} = $guarantordata->{$_};
270
            }
266
        }
271
        }
267
    }
272
    }
268
}
273
}
Lines 689-695 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
689
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
694
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
690
}
695
}
691
696
692
$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
697
$template->param( "showguarantor"  => $categorycode ? C4::Category->get($categorycode)->{'canbeguarantee'} : 1); # associate with step to know where you are
698
$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
693
$debug and warn "memberentry step: $step";
699
$debug and warn "memberentry step: $step";
694
$template->param(%data);
700
$template->param(%data);
695
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
701
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
(-)a/members/moremember.pl (-9 / +14 lines)
Lines 180-211 if ( $count ) { Link Here
180
    # the array, which is probably better done as a foreach loop.
180
    # the array, which is probably better done as a foreach loop.
181
    #
181
    #
182
    my @guaranteedata;
182
    my @guaranteedata;
183
    my $amount;
184
    my $totalmount = 0;
185
183
    for ( my $i = 0 ; $i < $count ; $i++ ) {
186
    for ( my $i = 0 ; $i < $count ; $i++ ) {
187
        my ($amount,$accts,undef) = GetMemberAccountRecords($guarantees->[$i]->{'borrowernumber'});
184
        push(@guaranteedata,
188
        push(@guaranteedata,
185
            {
189
            {
186
                borrowernumber => $guarantees->[$i]->{'borrowernumber'},
190
                borrowernumber => $guarantees->[$i]->{'borrowernumber'},
187
                cardnumber     => $guarantees->[$i]->{'cardnumber'},
191
                cardnumber     => $guarantees->[$i]->{'cardnumber'},
192
                finesguarantee => sprintf("%.2f",$amount),
188
                name           => $guarantees->[$i]->{'firstname'} . " "
193
                name           => $guarantees->[$i]->{'firstname'} . " "
189
                                . $guarantees->[$i]->{'surname'}
194
                                . $guarantees->[$i]->{'surname'}
190
            }
195
            }
191
        );
196
        );
197
        $totalmount += $amount;
192
    }
198
    }
193
    $template->param( guaranteeloop => \@guaranteedata );
199
    $template->param( guaranteeloop => \@guaranteedata );
200
    $template->param( amounttot => sprintf("%.2f",$totalmount));
194
    ( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
201
    ( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
195
}
202
}
196
else {
203
else {
197
    if ($data->{'guarantorid'}){
198
	    my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
199
		$template->param(guarantor => 1);
200
		foreach (qw(borrowernumber cardnumber firstname surname)) {        
201
			  $template->param("guarantor$_" => $guarantor->{$_});
202
        }
203
    }
204
	if ($category_type eq 'C'){
204
	if ($category_type eq 'C'){
205
		$template->param('C' => 1);
205
		$template->param('C' => 1);
206
	}
206
	}
207
}
207
}
208
208
if ($data->{'guarantorid'}){
209
    my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
210
    $template->param(guarantor => 1);
211
    foreach (qw(borrowernumber cardnumber firstname surname)) {
212
          $template->param("guarantor$_" => $guarantor->{$_});
213
    }
214
}
209
my %bor;
215
my %bor;
210
$bor{'borrowernumber'} = $borrowernumber;
216
$bor{'borrowernumber'} = $borrowernumber;
211
217
212
- 

Return to bug 12446