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

(-)a/C4/Members/AttributeTypes.pm (-1 / +17 lines)
Lines 69-75 If $all_fields is true, then each hashref also contains the other fields from bo Link Here
69
=cut
69
=cut
70
70
71
sub GetAttributeTypes {
71
sub GetAttributeTypes {
72
    my $all = @_ ? shift : 0;
72
    my ($all) = @_;
73
    my $select = $all ? '*' : 'code, description';
73
    my $select = $all ? '*' : 'code, description';
74
    my $dbh = C4::Context->dbh;
74
    my $dbh = C4::Context->dbh;
75
    my $sth = $dbh->prepare("SELECT $select FROM borrower_attribute_types ORDER by code");
75
    my $sth = $dbh->prepare("SELECT $select FROM borrower_attribute_types ORDER by code");
Lines 83-88 sub GetAttributeTypes_hashref { Link Here
83
    return \%hash;
83
    return \%hash;
84
}
84
}
85
85
86
=head2 AttributeTypeExists
87
88
  my $have_attr_xyz = C4::Members::AttributeTypes::AttributeTypeExists($code)
89
90
Returns true if we have attribute type C<$code>
91
in the database.
92
93
=cut
94
95
sub AttributeTypeExists {
96
    my ($code) = @_;
97
    my $dbh = C4::Context->dbh;
98
    my $exists = $dbh->selectrow_array("SELECT code FROM borrower_attribute_types WHERE code = ?", undef, $code);
99
    return $exists;
100
}
101
86
=head1 METHODS 
102
=head1 METHODS 
87
103
88
  my $attr_type = C4::Members::AttributeTypes->new($code, $description);
104
  my $attr_type = C4::Members::AttributeTypes->new($code, $description);
(-)a/C4/Members/Attributes.pm (-1 / +23 lines)
Lines 31-37 BEGIN { Link Here
31
    # set the version for version checking
31
    # set the version for version checking
32
    $VERSION = 3.01;
32
    $VERSION = 3.01;
33
    @ISA = qw(Exporter);
33
    @ISA = qw(Exporter);
34
    @EXPORT_OK = qw(GetBorrowerAttributes CheckUniqueness SetBorrowerAttributes
34
    @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes
35
                    extended_attributes_code_value_arrayref extended_attributes_merge
35
                    extended_attributes_code_value_arrayref extended_attributes_merge
36
					SearchIdMatchingAttribute);
36
					SearchIdMatchingAttribute);
37
    %EXPORT_TAGS = ( all => \@EXPORT_OK );
37
    %EXPORT_TAGS = ( all => \@EXPORT_OK );
Lines 94-99 sub GetBorrowerAttributes { Link Here
94
    return \@results;
94
    return \@results;
95
}
95
}
96
96
97
=head2 GetBorrowerAttributeValue
98
99
  my $value = C4::Members::Attributes::GetBorrowerAttributeValue($borrowernumber, $attribute_code);
100
101
Retrieve the value of an extended attribute C<$attribute_code> associated with the
102
patron specified by C<$borrowernumber>.
103
104
=cut
105
106
sub GetBorrowerAttributeValue {
107
    my $borrowernumber = shift;
108
    my $code = shift;
109
110
    my $dbh = C4::Context->dbh();
111
    my $query = "SELECT attribute
112
                 FROM borrower_attributes
113
                 WHERE borrowernumber = ?
114
                 AND code = ?";
115
    my $value = $dbh->selectrow_array($query, undef, $borrowernumber, $code);
116
    return $value;
117
}
118
97
=head2 SearchIdMatchingAttribute
119
=head2 SearchIdMatchingAttribute
98
120
99
  my $matching_records = C4::Members::Attributes::SearchIdMatchingAttribute($filter);
121
  my $matching_records = C4::Members::Attributes::SearchIdMatchingAttribute($filter);
(-)a/installer/data/mysql/en/mandatory/auth_values.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','0','No','No');
2
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','1','Yes','Yes');
(-)a/installer/data/mysql/en/mandatory/auth_values.txt (+1 lines)
Line 0 Link Here
1
Default Koha system authorised values
(-)a/installer/data/mysql/en/optional/patron_atributes.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO `borrower_attribute_types` (`code`, `description`, `repeatable`, `unique_id`, `opac_display`, `password_allowed`, `staff_searchable`, `authorised_value_category`)
2
VALUES ('SHOW_BCODE',  'Show barcode on the summary screen items listings', 0, 0, 1, 0, 0, 'YES_NO');
(-)a/installer/data/mysql/en/optional/patron_atributes.txt (+2 lines)
Line 0 Link Here
1
Useful patron atribute types:
2
* SHOW_BCODE - Show barcode on the patron summary screen items listings
(-)a/installer/data/mysql/updatedatabase.pl (+10 lines)
Lines 4209-4214 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4209
    SetVersion ($DBversion);
4209
    SetVersion ($DBversion);
4210
}
4210
}
4211
4211
4212
$DBversion = "3.03.00.XXX";
4213
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4214
4215
    $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','0','No','No')");
4216
    $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','1','Yes','Yes')");
4217
4218
	print "Upgrade to $DBversion done ( add generic boolean YES_NO authorised_values pair )\n";
4219
	SetVersion ($DBversion);
4220
}
4221
4212
=head1 FUNCTIONS
4222
=head1 FUNCTIONS
4213
4223
4214
=head2 DropAllForeignKeys($table)
4224
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl (-4 / +4 lines)
Lines 201-207 $.tablesorter.addParser({ Link Here
201
		<!-- TMPL_IF NAME="JacketImages" --><th>&nbsp;</th><!-- /TMPL_IF -->
201
		<!-- TMPL_IF NAME="JacketImages" --><th>&nbsp;</th><!-- /TMPL_IF -->
202
        <th>Title</th>
202
        <th>Title</th>
203
		<!-- TMPL_UNLESS NAME="item_level_itypes" --><th>Item Type</th> <!-- /TMPL_UNLESS -->
203
		<!-- TMPL_UNLESS NAME="item_level_itypes" --><th>Item Type</th> <!-- /TMPL_UNLESS -->
204
        <th>Barcode</th>
204
        <!-- TMPL_IF NAME="show_barcode" --><th>Barcode</th><!-- /TMPL_IF -->
205
        <th>Call No.</th>
205
        <th>Call No.</th>
206
        <th>Due</th>
206
        <th>Due</th>
207
        <!-- TMPL_IF name="OpacRenewalAllowed" -->
207
        <!-- TMPL_IF name="OpacRenewalAllowed" -->
Lines 242-248 $.tablesorter.addParser({ Link Here
242
                        <!-- TMPL_VAR NAME="author" -->
242
                        <!-- TMPL_VAR NAME="author" -->
243
                    </span></td>
243
                    </span></td>
244
                <!-- TMPL_UNLESS NAME="item_level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR name="description" -->" alt="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="description" --></td><!-- /TMPL_UNLESS -->
244
                <!-- TMPL_UNLESS NAME="item_level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR name="description" -->" alt="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="description" --></td><!-- /TMPL_UNLESS -->
245
                <td><!-- TMPL_VAR NAME="barcode" --></td>
245
                <!-- TMPL_IF NAME="show_barcode" --><td><!-- TMPL_VAR NAME="barcode" --></td><!-- /TMPL_IF -->
246
                <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
246
                <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
247
                <!-- TMPL_IF NAME="overdue" -->
247
                <!-- TMPL_IF NAME="overdue" -->
248
                    <td class="overdue"><!-- TMPL_VAR NAME="date_due" --></td>
248
                    <td class="overdue"><!-- TMPL_VAR NAME="date_due" --></td>
Lines 294-300 $.tablesorter.addParser({ Link Here
294
<!-- TMPL_IF NAME="JacketImages" --><th>&nbsp;</th><!-- /TMPL_IF -->
294
<!-- TMPL_IF NAME="JacketImages" --><th>&nbsp;</th><!-- /TMPL_IF -->
295
<th>Title</th>
295
<th>Title</th>
296
<!-- TMPL_UNLESS NAME="item_level_itypes" --><th>Item Type</th> <!-- /TMPL_UNLESS -->
296
<!-- TMPL_UNLESS NAME="item_level_itypes" --><th>Item Type</th> <!-- /TMPL_UNLESS -->
297
<th>Barcode</th>
297
<!-- TMPL_IF NAME="show_barcode" --><th>Barcode</th><!-- /TMPL_IF -->
298
<th>Call No.</th>
298
<th>Call No.</th>
299
<th>Due</th>
299
<th>Due</th>
300
<!-- TMPL_IF name="OpacRenewalAllowed" -->
300
<!-- TMPL_IF name="OpacRenewalAllowed" -->
Lines 326-332 $.tablesorter.addParser({ Link Here
326
<td><a href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" escape="html" --></a> <span class="item-details"><!-- TMPL_VAR NAME="author" --></span></td>
326
<td><a href="/cgi-bin/koha/opac-detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" escape="html" --></a> <span class="item-details"><!-- TMPL_VAR NAME="author" --></span></td>
327
327
328
<!-- TMPL_UNLESS NAME="item_level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR name="description" -->" alt="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="description" --></td><!-- /TMPL_UNLESS -->
328
<!-- TMPL_UNLESS NAME="item_level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR name="description" -->" alt="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="description" --></td><!-- /TMPL_UNLESS -->
329
<td><!-- TMPL_VAR NAME="barcode" --></td>
329
<!-- TMPL_IF NAME="show_barcode" --><td><!-- TMPL_VAR NAME="barcode" --></td><!-- /TMPL_IF -->
330
<td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
330
<td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
331
<td><!-- TMPL_VAR NAME="date_due" --></td>
331
<td><!-- TMPL_VAR NAME="date_due" --></td>
332
                <!-- TMPL_IF name="OpacRenewalAllowed" -->
332
                <!-- TMPL_IF name="OpacRenewalAllowed" -->
(-)a/opac/opac-user.pl (-1 / +11 lines)
Lines 27-32 use C4::Koha; Link Here
27
use C4::Circulation;
27
use C4::Circulation;
28
use C4::Reserves;
28
use C4::Reserves;
29
use C4::Members;
29
use C4::Members;
30
use C4::Members::AttributeTypes;
31
use C4::Members::Attributes qw/GetBorrowerAttributeValue/;
30
use C4::Output;
32
use C4::Output;
31
use C4::Biblio;
33
use C4::Biblio;
32
use C4::Items;
34
use C4::Items;
Lines 34-39 use C4::Dates qw/format_date/; Link Here
34
use C4::Letters;
36
use C4::Letters;
35
use C4::Branch; # GetBranches
37
use C4::Branch; # GetBranches
36
38
39
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
40
37
my $query = new CGI;
41
my $query = new CGI;
38
42
39
BEGIN {
43
BEGIN {
Lines 167-172 $template->param( issues_count => $count ); Link Here
167
$template->param( OVERDUES       => \@overdues );
171
$template->param( OVERDUES       => \@overdues );
168
$template->param( overdues_count => $overdues_count );
172
$template->param( overdues_count => $overdues_count );
169
173
174
my $show_barcode = C4::Members::AttributeTypes::AttributeTypeExists( ATTRIBUTE_SHOW_BARCODE );
175
if ($show_barcode) {
176
    my $patron_show_barcode = GetBorrowerAttributeValue($borrowernumber, ATTRIBUTE_SHOW_BARCODE);
177
    undef $show_barcode if defined($patron_show_barcode) && !$patron_show_barcode;
178
}
179
$template->param( show_barcode => 1 ) if $show_barcode;
180
170
# load the branches
181
# load the branches
171
my $branches = GetBranches();
182
my $branches = GetBranches();
172
my @branch_loop;
183
my @branch_loop;
173
- 

Return to bug 4157