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

(-)a/C4/Utils/DataTables/Members.pm (-2 lines)
Lines 2-8 package C4::Utils::DataTables::Members; Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use C4::Context;
4
use C4::Context;
5
use C4::Members;
6
use C4::Members::Attributes qw/get_guarantor_shared_attributes/;
5
use C4::Members::Attributes qw/get_guarantor_shared_attributes/;
7
use C4::Utils::DataTables;
6
use C4::Utils::DataTables;
8
use Koha::DateUtils;
7
use Koha::DateUtils;
Lines 58-64 sub search { Link Here
58
        }
57
        }
59
    }
58
    }
60
59
61
    $dbh = C4::Context->dbh;
62
    my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode phone phonepro mobile fax email emailpro);
60
    my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode phone phonepro mobile fax email emailpro);
63
    if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){
61
    if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){
64
        foreach my $item (@guarantor_attributes) {
62
        foreach my $item (@guarantor_attributes) {
(-)a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql (-11 lines)
Lines 1-11 Link Here
1
-- ******** --
2
-- SYSPREFS --
3
-- ******** --
4
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
5
VALUES ('GuarantorFields', 'streetnumber|address|address2|city|state|zipcode|country|branchcode|phonepro|mobile|email|emailpro|fax', NULL, 'Fields to be transfered from guarantor to guarantee.', 'free')
6
7
-- ********* --
8
-- STRUCTURE --
9
-- ********* --
10
ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0' AFTER `checkprevcheckout`;
11
UPDATE categories SET canbeguarantee = 1 WHERE category_type = 'P' OR category_type = 'C';
(-)a/installer/data/mysql/atomicupdate/bug_12446.perl (+21 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    ## ******** ##
4
    ## SYSPREFS ##
5
    ## ******** ##
6
    $dbh->do(q{
7
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
8
        VALUES ('GuarantorFields', 'streetnumber|address|address2|city|state|zipcode|country|branchcode|phonepro|mobile|email|emailpro|fax', NULL, 'Fields to be transfered from guarantor to guarantee.', 'free')
9
    });
10
11
    ## ********* ##
12
    ## STRUCTURE ##
13
    ## ********* ##
14
    if ( !column_exists( 'categories', 'canbeguarantee') ){
15
        $dbh->do("ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0' AFTER `checkprevcheckout`");
16
        $dbh->do("UPDATE categories SET canbeguarantee = 1 WHERE category_type = 'P' OR category_type = 'C'");
17
    }
18
19
    SetVersion( $DBversion );
20
    print "Upgrade to $DBversion done (Bug 12446 - Enable an adult to have a guarantor)\n";
21
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 322-330 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
322
  `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
322
  `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
323
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
323
  `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
324
  `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'.
324
  `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'.
325
  `canbeguarantee` tinyint(1) NOT NULL default '0',
325
  `reset_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can do the password reset flow,
326
  `reset_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can do the password reset flow,
326
  `change_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can change their passwords in the OAPC
327
  `change_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can change their passwords in the OAPC
327
  `canbeguarantee` tinyint(1) NOT NULL default '0'
328
  PRIMARY KEY  (`categorycode`),
328
  PRIMARY KEY  (`categorycode`),
329
  UNIQUE KEY `categorycode` (`categorycode`)
329
  UNIQUE KEY `categorycode` (`categorycode`)
330
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
330
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt (-1 / +1 lines)
Lines 220-226 Link Here
220
                e.preventDefault();
220
                e.preventDefault();
221
                var borrowernumber = $(this).data("borrowernumber");
221
                var borrowernumber = $(this).data("borrowernumber");
222
                var borrower_data = $("#borrower_data"+borrowernumber).val();
222
                var borrower_data = $("#borrower_data"+borrowernumber).val();
223
                var guarantor_attributes = $("#guarantor_attributes").val();
223
                var guarantor_attributes = $("#guarantor_attributes"+borrowernumber).val();
224
                if ( !guarantor_attributes )
224
                if ( !guarantor_attributes )
225
                    guarantor_attributes = "{}";
225
                    guarantor_attributes = "{}";
226
                select_user( borrowernumber, JSON.parse(borrower_data), JSON.parse(guarantor_attributes) );
226
                select_user( borrowernumber, JSON.parse(borrower_data), JSON.parse(guarantor_attributes) );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-2 / +2 lines)
Lines 265-271 Link Here
265
                                                    <tr>
265
                                                    <tr>
266
                                                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
266
                                                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
267
                                                            <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber | uri %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></td>
267
                                                            <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber | uri %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></td>
268
                                                            <td style='text-align:right'>[% guarantee.account.balance | html %]</td>
268
                                                            <td style='text-align:right'>[% guarantee.account.balance | $Price %]</td>
269
                                                        [% ELSE %]
269
                                                        [% ELSE %]
270
                                                            <td>[% guarantee.firstname | html %] [% guarantee.surname | html %]</td>
270
                                                            <td>[% guarantee.firstname | html %] [% guarantee.surname | html %]</td>
271
                                                        [% END %]
271
                                                        [% END %]
Lines 273-279 Link Here
273
                                                    [% END %]
273
                                                    [% END %]
274
                                                    [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
274
                                                    [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
275
                                                       <td>Total</td>
275
                                                       <td>Total</td>
276
                                                       <td style='text-align:right'>[% amounttot | html %]</td>
276
                                                       <td style='text-align:right'>[% amount_total | $Price %]</td>
277
                                                    [% END %]
277
                                                    [% END %]
278
                                                </table>
278
                                                </table>
279
                                            </li>
279
                                            </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt (-1 / +1 lines)
Lines 18-24 Link Here
18
                "dt_address":
18
                "dt_address":
19
                    "[% INCLUDE escape_address data=data %]",
19
                    "[% INCLUDE escape_address data=data %]",
20
                "dt_action":
20
                "dt_action":
21
                    "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"borrower_data[% data.borrowernumber | html %]\" value=\"[% To.json(data) | html %]\" /><input type=\"hidden\" id=\"guarantor_attributes\" name=\"guarantor_attributes\" value=\"[% To.json(attributes) | html %]\" />"
21
                    "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"borrower_data[% data.borrowernumber | html %]\" value=\"[% To.json(data) | html %]\" /><input type=\"hidden\" id=\"guarantor_attributes[% data.borrowernumber | html %]\" name=\"guarantor_attributes[% data.borrowernumber | html %]\" value=\"[% To.json(attributes) | html %]\" />"
22
            }[% UNLESS loop.last %],[% END %]
22
            }[% UNLESS loop.last %],[% END %]
23
        [% END %]
23
        [% END %]
24
    ]
24
    ]
(-)a/members/moremember.pl (-10 / +5 lines)
Lines 116-134 $template->param( Link Here
116
116
117
my $relatives_issues_count =
117
my $relatives_issues_count =
118
    Koha::Checkouts->count({ borrowernumber => \@relatives });
118
    Koha::Checkouts->count({ borrowernumber => \@relatives });
119
my $count = scalar @guarantees;
120
if ( $count ) {
121
    $template->param( isguarantee => 1 );
122
119
123
    my $totalmount = 0;
120
if ( @guarantees ) {
121
    my $total_amount = 0;
124
122
125
    foreach my $guarantee (@guarantees){
123
    foreach my $guarantee (@guarantees){
126
124
        $total_amount += $guarantee->account->balance;
127
        $totalmount += $guarantee->account->balance;
128
129
    }
125
    }
130
    $template->param( guarantees => \@guarantees);
126
131
    $template->param( amounttot => sprintf("%.2f",$totalmount));
127
    $template->param( amount_total => $total_amount );
132
}
128
}
133
129
134
# Calculate and display patron's age
130
# Calculate and display patron's age
135
- 

Return to bug 12446