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 (+14 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');
14
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 489-495 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
489
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
489
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
490
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
490
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
491
  `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
  `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
492
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
492
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category,
493
  `canbeguarantee` tinyint(1) NOT NULL default '0'
493
  PRIMARY KEY  (`categorycode`),
494
  PRIMARY KEY  (`categorycode`),
494
  UNIQUE KEY `categorycode` (`categorycode`)
495
  UNIQUE KEY `categorycode` (`categorycode`)
495
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
496
) 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 490-494 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
490
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
492
('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
491
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
493
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
492
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
494
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
493
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
495
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
494
;
496
;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (-1 / +1 lines)
Lines 140-146 function searchToHold(){ Link Here
140
140
141
    [% IF ( CAN_user_borrowers ) %]
141
    [% IF ( CAN_user_borrowers ) %]
142
        [% IF ( adultborrower AND activeBorrowerRelationship ) %]
142
        [% IF ( adultborrower AND activeBorrowerRelationship ) %]
143
            <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]"><i class="icon-plus"></i> Add child</a>
143
            <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>
144
        [% END %]
144
        [% END %]
145
        [% IF ( CAN_user_borrowers ) %]
145
        [% IF ( CAN_user_borrowers ) %]
146
            <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>
146
            <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 (+20 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 canbeguarantee_bydefault = ['C','P'];
29
        var selected = $(this).val();
30
        $("#canbeguarantee").val( ( $.inArray(selected, canbeguarantee_bydefault) != -1 ) ? "1" : "0" );
31
    });
27
});
32
});
28
	function isNotNull(f,noalert) {
33
	function isNotNull(f,noalert) {
29
		if (f.value.length ==0) {
34
		if (f.value.length ==0) {
Lines 197-202 Link Here
197
					</select>
202
					</select>
198
        <span class="required">Required</span>
203
        <span class="required">Required</span>
199
    </li>
204
    </li>
205
    <li>
206
        <label for="canbeguarantee">Can be guarantee</label>
207
        <select name="canbeguarantee" id="canbeguarantee">
208
            [% IF canbeguarantee %]
209
                <option value="1" selected>Yes</option>
210
                <option value="0">No</option>
211
            [% ELSE %]
212
                <option value="1">Yes</option>
213
                <option value="0" selected>No</option>
214
            [% END %]
215
        <select>
216
    </li>
200
    <li><label for="branches">Branches limitation: </label>
217
    <li><label for="branches">Branches limitation: </label>
201
        <select id="branches" name="branches" multiple size="10">
218
        <select id="branches" name="branches" multiple size="10">
202
            <option value="">All branches</option>
219
            <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>
316
	<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>
317
	<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>
318
	<tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
319
    <tr><th scope="row">Can be guarantee</th><td>[% IF ( canbeguarantee ) %]Yes[% ELSE %]No[% END %]</td></tr>
302
    <tr>
320
    <tr>
303
        <th scope="row">Default privacy: </th>
321
        <th scope="row">Default privacy: </th>
304
        <td>
322
        <td>
Lines 351-356 Link Here
351
            <th scope="col">Messaging</th>
369
            <th scope="col">Messaging</th>
352
            [% END %]
370
            [% END %]
353
            <th scope="col">Branches limitations</th>
371
            <th scope="col">Branches limitations</th>
372
            <th scope="col">Can be guarantee</th>
354
            <th scope="col">Default privacy</th>
373
            <th scope="col">Default privacy</th>
355
            <th scope="col">&nbsp; </th>
374
            <th scope="col">&nbsp; </th>
356
            <th scope="col">&nbsp; </th>
375
            <th scope="col">&nbsp; </th>
Lines 425-430 Link Here
425
                                No limitation
444
                                No limitation
426
                            [% END %]
445
                            [% END %]
427
                        </td>
446
                        </td>
447
                        <td>[% IF loo.canbeguarantee %]Yes[% ELSE %]No[% END %]</td>
428
                        <td>
448
                        <td>
429
                            [% SWITCH loo.default_privacy %]
449
                            [% SWITCH loo.default_privacy %]
430
                            [% CASE 'default' %]
450
                            [% 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 131-144 Link Here
131
            .val(borrower.firstname)
131
            .val(borrower.firstname)
132
            .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
132
            .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
133
133
134
        form.streetnumber.value = borrower.streetnumber;
134
        [% FOREACH field IN guarantor_attributes %]
135
        form.address.value = borrower.address;
135
            $(form.[% field %]).val(borrower.[% field %]);
136
        form.address2.value = borrower.address2;
136
        [% END %]
137
        form.city.value = borrower.city;
138
        form.state.value = borrower.state;
139
        form.zipcode.value = borrower.zipcode;
140
        form.country.value = borrower.country;
141
        form.branchcode.value = borrower.branchcode;
142
137
143
        form.guarantorsearch.value = _("Change");
138
        form.guarantorsearch.value = _("Change");
144
139
Lines 434-440 Link Here
434
	            [% END %]
429
	            [% END %]
435
	        </li>
430
	        </li>
436
[% ELSE %]
431
[% ELSE %]
437
 [% IF ( C ) %]
438
 [% IF ( guarantorid ) %]
432
 [% IF ( guarantorid ) %]
439
 <li id="contact-details">
433
 <li id="contact-details">
440
 [% ELSE %]
434
 [% ELSE %]
Lines 452-460 Link Here
452
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
446
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" />
453
     [% END %]
447
     [% END %]
454
 </li>
448
 </li>
455
        [% END %]
449
     [% UNLESS nocontactfirstname %]
456
        [% UNLESS nocontactfirstname %]
450
<li>
457
 <li>
458
     <label for="contactfirstname">First name: </label>
451
     <label for="contactfirstname">First name: </label>
459
     [% IF ( guarantorid ) %]
452
     [% IF ( guarantorid ) %]
460
     <span>[% contactfirstname %]</span>
453
     <span>[% contactfirstname %]</span>
Lines 1006-1011 Link Here
1006
                <li data-category_code="[% patron_attribute.category_code %]">
999
                <li data-category_code="[% patron_attribute.category_code %]">
1007
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1000
                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1008
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1001
                        <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1002
                        <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" />
1009
                        [% IF ( patron_attribute.use_dropdown ) %]
1003
                        [% IF ( patron_attribute.use_dropdown ) %]
1010
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1004
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1011
                                <option value=""></option>
1005
                                <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 / +14 lines)
Lines 40-45 use C4::Log; Link Here
40
use C4::Letters;
40
use C4::Letters;
41
use C4::Branch; # GetBranches
41
use C4::Branch; # GetBranches
42
use C4::Form::MessagingPreferences;
42
use C4::Form::MessagingPreferences;
43
use C4::Category;
43
use Koha::Borrower::Debarments;
44
use Koha::Borrower::Debarments;
44
use Koha::DateUtils;
45
use Koha::DateUtils;
45
use Email::Valid;
46
use Email::Valid;
Lines 237-244 if ( ( $op eq 'insert' ) and !$nodouble ) { Link Here
237
    }
238
    }
238
}
239
}
239
240
240
  #recover all data from guarantor address phone ,fax... 
241
#recover all data from guarantor address phone ,fax... 
241
if ( $guarantorid ) {
242
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) {
243
242
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
244
    if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
243
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
245
        $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
244
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
246
        $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
Lines 249-257 if ( $guarantorid ) { Link Here
249
	        foreach (qw(streetnumber address streettype address2
251
	        foreach (qw(streetnumber address streettype address2
250
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
252
                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
251
                        B_streetnumber B_streettype B_address B_address2
253
                        B_streetnumber B_streettype B_address B_address2
252
                        B_city B_state B_zipcode B_country B_email B_phone)) {
254
                        B_city B_state B_zipcode B_country B_email B_phone)) {		        
253
		        $newdata{$_} = $guarantordata->{$_};
255
                        $newdata{$_} = $guarantordata->{$_};
254
	        }
256
	        }
257
            my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField");
258
            my @field_add=split(/\|/,$additionalGuarantorField);
259
            my $guarantordata=GetMember(borrowernumber => $guarantorid);
260
            foreach (@field_add) {
261
                $newdata{$_} = $guarantordata->{$_};
262
            }
255
        }
263
        }
256
    }
264
    }
257
}
265
}
Lines 689-695 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
689
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
697
    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
690
}
698
}
691
699
692
$template->param( "showguarantor"  => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
700
$template->param( "showguarantor"  => $categorycode ? C4::Category->get($categorycode)->{'canbeguarantee'} : 1); # associate with step to know where you are
701
$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() );
693
$debug and warn "memberentry step: $step";
702
$debug and warn "memberentry step: $step";
694
$template->param(%data);
703
$template->param(%data);
695
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
704
$template->param( "step_$step"  => 1) if $step;	# associate with step to know where u are
(-)a/members/moremember.pl (-13 / +18 lines)
Lines 180-212 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));
201
    ( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' );
202
194
}
203
}
195
else {
204
else {
196
    if ($data->{'guarantorid'}){
205
	#if ($category_type eq 'C'){
197
	    my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
206
	#	$template->param('C' => 1);
198
		$template->param(guarantor => 1);
207
	#}
199
		foreach (qw(borrowernumber cardnumber firstname surname)) {        
208
}
200
			  $template->param("guarantor$_" => $guarantor->{$_});
209
if ($data->{'guarantorid'}){
201
        }
210
    my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
211
    $template->param(guarantor => 1);
212
    foreach (qw(borrowernumber cardnumber firstname surname)) {
213
          $template->param("guarantor$_" => $guarantor->{$_});
202
    }
214
    }
203
	if ($category_type eq 'C'){
204
		$template->param('C' => 1);
205
	}
206
}
215
}
207
208
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' );
209
210
my %bor;
216
my %bor;
211
$bor{'borrowernumber'} = $borrowernumber;
217
$bor{'borrowernumber'} = $borrowernumber;
212
218
213
- 

Return to bug 12446