Bugzilla – Attachment 3620 Details for
Bug 4157
Display of barcode in checked out items in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Signoff 2/2
0002-wr76595-bug-4157-Control-barcode-display-with-a-borr.patch (text/plain), 10.06 KB, created by
Matthias Meusburger
on 2011-04-04 12:14:18 UTC
(
hide
)
Description:
Signoff 2/2
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2011-04-04 12:14:18 UTC
Size:
10.06 KB
patch
obsolete
>From 05e1d69ecb67f86477eaef2137d93d829d4a6cd4 Mon Sep 17 00:00:00 2001 >From: Srdjan Jankovic <srdjan@catalyst.net.nz> >Date: Thu, 31 Mar 2011 17:55:06 +1300 >Subject: [PATCH 2/2] [SIGNED-OFF] wr76595 (bug 4157): Control barcode display with a borrower attribute > > >Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com> >--- > C4/Members/AttributeTypes.pm | 18 ++++++++++++++- > C4/Members/Attributes.pm | 24 +++++++++++++++++++- > installer/data/mysql/en/mandatory/auth_values.sql | 2 + > installer/data/mysql/en/mandatory/auth_values.txt | 1 + > .../data/mysql/en/optional/patron_atributes.sql | 2 + > .../data/mysql/en/optional/patron_atributes.txt | 2 + > installer/data/mysql/updatedatabase.pl | 10 ++++++++ > koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl | 8 +++--- > opac/opac-user.pl | 11 +++++++++ > 9 files changed, 72 insertions(+), 6 deletions(-) > create mode 100644 installer/data/mysql/en/mandatory/auth_values.sql > create mode 100644 installer/data/mysql/en/mandatory/auth_values.txt > create mode 100644 installer/data/mysql/en/optional/patron_atributes.sql > create mode 100644 installer/data/mysql/en/optional/patron_atributes.txt > >diff --git a/C4/Members/AttributeTypes.pm b/C4/Members/AttributeTypes.pm >index 21d17eb..3a05268 100644 >--- a/C4/Members/AttributeTypes.pm >+++ b/C4/Members/AttributeTypes.pm >@@ -69,7 +69,7 @@ If $all_fields is true, then each hashref also contains the other fields from bo > =cut > > sub GetAttributeTypes { >- my $all = @_ ? shift : 0; >+ my ($all) = @_; > my $select = $all ? '*' : 'code, description'; > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare("SELECT $select FROM borrower_attribute_types ORDER by code"); >@@ -83,6 +83,22 @@ sub GetAttributeTypes_hashref { > return \%hash; > } > >+=head2 AttributeTypeExists >+ >+ my $have_attr_xyz = C4::Members::AttributeTypes::AttributeTypeExists($code) >+ >+Returns true if we have attribute type C<$code> >+in the database. >+ >+=cut >+ >+sub AttributeTypeExists { >+ my ($code) = @_; >+ my $dbh = C4::Context->dbh; >+ my $exists = $dbh->selectrow_array("SELECT code FROM borrower_attribute_types WHERE code = ?", undef, $code); >+ return $exists; >+} >+ > =head1 METHODS > > my $attr_type = C4::Members::AttributeTypes->new($code, $description); >diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm >index 1db9424..24c6f71 100644 >--- a/C4/Members/Attributes.pm >+++ b/C4/Members/Attributes.pm >@@ -31,7 +31,7 @@ BEGIN { > # set the version for version checking > $VERSION = 3.01; > @ISA = qw(Exporter); >- @EXPORT_OK = qw(GetBorrowerAttributes CheckUniqueness SetBorrowerAttributes >+ @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes > extended_attributes_code_value_arrayref extended_attributes_merge > SearchIdMatchingAttribute); > %EXPORT_TAGS = ( all => \@EXPORT_OK ); >@@ -94,6 +94,28 @@ sub GetBorrowerAttributes { > return \@results; > } > >+=head2 GetBorrowerAttributeValue >+ >+ my $value = C4::Members::Attributes::GetBorrowerAttributeValue($borrowernumber, $attribute_code); >+ >+Retrieve the value of an extended attribute C<$attribute_code> associated with the >+patron specified by C<$borrowernumber>. >+ >+=cut >+ >+sub GetBorrowerAttributeValue { >+ my $borrowernumber = shift; >+ my $code = shift; >+ >+ my $dbh = C4::Context->dbh(); >+ my $query = "SELECT attribute >+ FROM borrower_attributes >+ WHERE borrowernumber = ? >+ AND code = ?"; >+ my $value = $dbh->selectrow_array($query, undef, $borrowernumber, $code); >+ return $value; >+} >+ > =head2 SearchIdMatchingAttribute > > my $matching_records = C4::Members::Attributes::SearchIdMatchingAttribute($filter); >diff --git a/installer/data/mysql/en/mandatory/auth_values.sql b/installer/data/mysql/en/mandatory/auth_values.sql >new file mode 100644 >index 0000000..d7fb280 >--- /dev/null >+++ b/installer/data/mysql/en/mandatory/auth_values.sql >@@ -0,0 +1,2 @@ >+INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','0','No','No'); >+INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','1','Yes','Yes'); >diff --git a/installer/data/mysql/en/mandatory/auth_values.txt b/installer/data/mysql/en/mandatory/auth_values.txt >new file mode 100644 >index 0000000..effc454 >--- /dev/null >+++ b/installer/data/mysql/en/mandatory/auth_values.txt >@@ -0,0 +1 @@ >+Default Koha system authorised values >diff --git a/installer/data/mysql/en/optional/patron_atributes.sql b/installer/data/mysql/en/optional/patron_atributes.sql >new file mode 100644 >index 0000000..17d7b8a >--- /dev/null >+++ b/installer/data/mysql/en/optional/patron_atributes.sql >@@ -0,0 +1,2 @@ >+INSERT INTO `borrower_attribute_types` (`code`, `description`, `repeatable`, `unique_id`, `opac_display`, `password_allowed`, `staff_searchable`, `authorised_value_category`) >+VALUES ('SHOW_BCODE', 'Show barcode on the summary screen items listings', 0, 0, 1, 0, 0, 'YES_NO'); >diff --git a/installer/data/mysql/en/optional/patron_atributes.txt b/installer/data/mysql/en/optional/patron_atributes.txt >new file mode 100644 >index 0000000..50d91d1 >--- /dev/null >+++ b/installer/data/mysql/en/optional/patron_atributes.txt >@@ -0,0 +1,2 @@ >+Useful patron atribute types: >+* SHOW_BCODE - Show barcode on the patron summary screen items listings >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 5c71849..bc55025 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4209,6 +4209,16 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.03.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ >+ $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','0','No','No')"); >+ $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('YES_NO','1','Yes','Yes')"); >+ >+ print "Upgrade to $DBversion done ( add generic boolean YES_NO authorised_values pair )\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl >index 5513f13..08a33da 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl >@@ -201,7 +201,7 @@ $.tablesorter.addParser({ > <!-- TMPL_IF NAME="JacketImages" --><th> </th><!-- /TMPL_IF --> > <th>Title</th> > <!-- TMPL_UNLESS NAME="item_level_itypes" --><th>Item Type</th> <!-- /TMPL_UNLESS --> >- <th>Barcode</th> >+ <!-- TMPL_IF NAME="show_barcode" --><th>Barcode</th><!-- /TMPL_IF --> > <th>Call No.</th> > <th>Due</th> > <!-- TMPL_IF name="OpacRenewalAllowed" --> >@@ -242,7 +242,7 @@ $.tablesorter.addParser({ > <!-- TMPL_VAR NAME="author" --> > </span></td> > <!-- 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 --> >- <td><!-- TMPL_VAR NAME="barcode" --></td> >+ <!-- TMPL_IF NAME="show_barcode" --><td><!-- TMPL_VAR NAME="barcode" --></td><!-- /TMPL_IF --> > <td><!-- TMPL_VAR NAME="itemcallnumber" --></td> > <!-- TMPL_IF NAME="overdue" --> > <td class="overdue"><!-- TMPL_VAR NAME="date_due" --></td> >@@ -294,7 +294,7 @@ $.tablesorter.addParser({ > <!-- TMPL_IF NAME="JacketImages" --><th> </th><!-- /TMPL_IF --> > <th>Title</th> > <!-- TMPL_UNLESS NAME="item_level_itypes" --><th>Item Type</th> <!-- /TMPL_UNLESS --> >-<th>Barcode</th> >+<!-- TMPL_IF NAME="show_barcode" --><th>Barcode</th><!-- /TMPL_IF --> > <th>Call No.</th> > <th>Due</th> > <!-- TMPL_IF name="OpacRenewalAllowed" --> >@@ -326,7 +326,7 @@ $.tablesorter.addParser({ > <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> > > <!-- 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 --> >-<td><!-- TMPL_VAR NAME="barcode" --></td> >+<!-- TMPL_IF NAME="show_barcode" --><td><!-- TMPL_VAR NAME="barcode" --></td><!-- /TMPL_IF --> > <td><!-- TMPL_VAR NAME="itemcallnumber" --></td> > <td><!-- TMPL_VAR NAME="date_due" --></td> > <!-- TMPL_IF name="OpacRenewalAllowed" --> >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 23de179..c16eaaf 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -27,6 +27,8 @@ use C4::Koha; > use C4::Circulation; > use C4::Reserves; > use C4::Members; >+use C4::Members::AttributeTypes; >+use C4::Members::Attributes qw/GetBorrowerAttributeValue/; > use C4::Output; > use C4::Biblio; > use C4::Items; >@@ -34,6 +36,8 @@ use C4::Dates qw/format_date/; > use C4::Letters; > use C4::Branch; # GetBranches > >+use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; >+ > my $query = new CGI; > > BEGIN { >@@ -167,6 +171,13 @@ $template->param( issues_count => $count ); > $template->param( OVERDUES => \@overdues ); > $template->param( overdues_count => $overdues_count ); > >+my $show_barcode = C4::Members::AttributeTypes::AttributeTypeExists( ATTRIBUTE_SHOW_BARCODE ); >+if ($show_barcode) { >+ my $patron_show_barcode = GetBorrowerAttributeValue($borrowernumber, ATTRIBUTE_SHOW_BARCODE); >+ undef $show_barcode if defined($patron_show_barcode) && !$patron_show_barcode; >+} >+$template->param( show_barcode => 1 ) if $show_barcode; >+ > # load the branches > my $branches = GetBranches(); > my @branch_loop; >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 4157
:
3568
|
3569
|
3619
| 3620