From 3af64e9845fdcf35742c1996ee6856bbd988bbe1 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 26 Feb 2010 16:06:35 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 5436: Extended patron attributes display improvements (MT #2262) member search improving if only one member is found, go directly to his details. change borrower link in return.pl go to circulation.pl instead of moremembers.pl (MT #2262) Show extended attributes in borrower toolbar This made some modifications to be more generic, and to show extended attributes in borrower "toolbar". It hide by default the borrower address, and the user have a toggle link to show/hide the user address. (bug #MT2262) don't show all attributes this hide non-active extended attributes in circulation. (MT2262) Followup : Enhancement to extended attributes display View/Hide address improvement in moremember.pl Signed-off-by: Henri-Damien LAURENT --- C4/Members.pm | 46 ++++++++- C4/Members/AttributeTypes.pm | 31 +++++- C4/Members/Attributes.pm | 3 +- admin/patron-attr-types.pl | 9 ++- circ/circulation.pl | 13 +-- .../0009-patron-attr-display-checkout.pl | 7 ++ installer/data/mysql/kohastructure.sql | 1 + .../intranet-tmpl/prog/en/css/staff-global.css | 34 ++++++- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 111 +++++++++++++------- .../prog/en/modules/admin/patron-attr-types.tmpl | 5 + .../prog/en/modules/circ/returns.tmpl | 2 +- .../prog/en/modules/members/moremember.tmpl | 2 +- .../intranet-tmpl/prog/img/more-right-arrow.gif | Bin 0 -> 81 bytes members/member.pl | 6 + members/moremember.pl | 3 +- 15 files changed, 212 insertions(+), 61 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/0009-patron-attr-display-checkout.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/img/more-right-arrow.gif diff --git a/C4/Members.pm b/C4/Members.pm index bf73e0e..3b24783 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -26,12 +26,13 @@ use C4::Dates qw(format_date_in_iso); use Digest::MD5 qw(md5_base64); use Date::Calc qw/Today Add_Delta_YM/; use C4::Log; # logaction +use C4::Branch; use C4::Overdues; use C4::Reserves; use C4::Accounts; use C4::Biblio; use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable); -use C4::Members::Attributes qw(SearchIdMatchingAttribute); +use C4::Members::Attributes qw(SearchIdMatchingAttribute GetBorrowerAttributes); our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug); @@ -91,6 +92,8 @@ BEGIN { &DeleteMessage &GetMessages &GetMessagesCount + + &SetMemberInfosInTemplate ); #Modify data @@ -1705,6 +1708,47 @@ sub DelMember { return $sth->rows; } +=head2 SetMemberInfosInTemplate + &SetMemberInfosInTemplate($borrowernumber, $template) + + +Settings borrower informations for template user + +=cut + +sub SetMemberInfosInTemplate { + my ($borrowernumber, $template) = @_; + + my $borrower = GetMemberDetails( $borrowernumber, 0 ); + foreach my $key (keys %$borrower){ + $template->param($key => $borrower->{$key}); + } + + # Computes full borrower address + my (undef, $roadttype_hashref) = &GetRoadTypes(); + my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; + $template->param(is_child => ($borrower->{'category_type'} eq 'C'), + address => $address, + branchname => GetBranchName($borrower->{'branchcode'}), + ); + + foreach (qw(dateenrolled dateexpiry dateofbirth)) { + my $userdate = $borrower->{$_}; + unless ($userdate) { + $borrower->{$_} = ''; + next; + } + $userdate = C4::Dates->new($userdate,'iso')->output('syspref'); + $borrower->{$_} = $userdate || ''; + $template->param( $_ => $userdate ); + } + + my $attributes = GetBorrowerAttributes($borrowernumber); + $template->param( + extendedattributes => $attributes, + ); +} + =head2 ExtendMemberSubscriptionTo (OUEST-PROVENCE) $date = ExtendMemberSubscriptionTo($borrowerid, $date); diff --git a/C4/Members/AttributeTypes.pm b/C4/Members/AttributeTypes.pm index 21d17eb..37193fa 100644 --- a/C4/Members/AttributeTypes.pm +++ b/C4/Members/AttributeTypes.pm @@ -102,6 +102,7 @@ sub new { $self->{'opac_display'} = 0; $self->{'password_allowed'} = 0; $self->{'staff_searchable'} = 0; + $self->{'display_checkout'} = 0; $self->{'authorised_value_category'} = ''; bless $self, $class; @@ -136,6 +137,7 @@ sub fetch { $self->{'opac_display'} = $row->{'opac_display'}; $self->{'password_allowed'} = $row->{'password_allowed'}; $self->{'staff_searchable'} = $row->{'staff_searchable'}; + $self->{'display_checkout'} = $row->{'display_checkout'}; $self->{'authorised_value_category'} = $row->{'authorised_value_category'}; bless $self, $class; @@ -166,14 +168,15 @@ sub store { opac_display = ?, password_allowed = ?, staff_searchable = ?, - authorised_value_category = ? + authorised_value_category = ?, + display_checkout = ? WHERE code = ?"); } else { $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types (description, repeatable, unique_id, opac_display, password_allowed, - staff_searchable, authorised_value_category, code) + staff_searchable, authorised_value_category, display_checkout, code) VALUES (?, ?, ?, ?, ?, - ?, ?, ?)"); + ?, ?, ?, ?)"); } $sth->bind_param(1, $self->{'description'}); $sth->bind_param(2, $self->{'repeatable'}); @@ -182,7 +185,8 @@ sub store { $sth->bind_param(5, $self->{'password_allowed'}); $sth->bind_param(6, $self->{'staff_searchable'}); $sth->bind_param(7, $self->{'authorised_value_category'}); - $sth->bind_param(8, $self->{'code'}); + $sth->bind_param(8, $self->{'display_checkout'}); + $sth->bind_param(9, $self->{'code'}); $sth->execute; } @@ -288,6 +292,25 @@ sub staff_searchable { @_ ? $self->{'staff_searchable'} = ((shift) ? 1 : 0) : $self->{'staff_searchable'}; } +=head2 display_checkout + +=over 4 + +my $display_checkout = $attr_type->display_checkout(); +$attr_type->display_checkout($display_checkout); + +=back + +Accessor. The C<$display_checkout> argument +is interpreted as a Perl boolean. + +=cut + +sub display_checkout { + my $self = shift; + @_ ? $self->{'display_checkout'} = ((shift) ? 1 : 0) : $self->{'display_checkout'}; +} + =head2 authorised_value_category my $authorised_value_category = $attr_type->authorised_value_category(); diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm index 1db9424..4976d76 100644 --- a/C4/Members/Attributes.pm +++ b/C4/Members/Attributes.pm @@ -72,7 +72,7 @@ sub GetBorrowerAttributes { my $opac_only = @_ ? shift : 0; my $dbh = C4::Context->dbh(); - my $query = "SELECT code, description, attribute, lib, password + my $query = "SELECT code, description, attribute, lib, password, display_checkout FROM borrower_attributes JOIN borrower_attribute_types USING (code) LEFT JOIN authorised_values ON (category = authorised_value_category AND attribute = authorised_value) @@ -89,6 +89,7 @@ sub GetBorrowerAttributes { value => $row->{'attribute'}, value_description => $row->{'lib'}, password => $row->{'password'}, + display_checkout => $row->{'display_checkout'}, } } return \@results; diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index 1dfe442..c32b6c2 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -106,6 +106,9 @@ sub error_add_attribute_type_form { if ($input->param('staff_searchable')) { $template->param(staff_searchable_checked => 'checked="checked"'); } + if ($input->param('display_checkout')) { + $template->param(display_checkout_checked => 'checked="checked"'); + } $template->param( attribute_type_form => 1, @@ -147,6 +150,8 @@ sub add_update_attribute_type { $attr_type->authorised_value_category($authorised_value_category); my $password_allowed = $input->param('password_allowed'); $attr_type->password_allowed($password_allowed); + my $display_checkout = $input->param('display_checkout'); + $attr_type->display_checkout($display_checkout); if ($op eq 'edit') { $template->param(edited_attribute_type => $attr_type->code()); @@ -222,7 +227,9 @@ sub edit_attribute_type_form { if ($attr_type->staff_searchable()) { $template->param(staff_searchable_checked => 'checked="checked"'); } - + if ($attr_type->display_checkout()) { + $template->param(display_checkout_checked => 'checked="checked"'); + } authorised_value_category_list($template, $attr_type->authorised_value_category()); $template->param( diff --git a/circ/circulation.pl b/circ/circulation.pl index 5242193..e5d56cf 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -220,8 +220,8 @@ if ($borrowernumber) { # Warningdate is the date that the warning starts appearing my ( $today_year, $today_month, $today_day) = Today(); - my ($warning_year, $warning_month, $warning_day) = split /-/, $borrower->{'dateexpiry'}; - my ( $enrol_year, $enrol_month, $enrol_day) = split /-/, $borrower->{'dateenrolled'}; + my ($warning_year, $warning_month, $warning_day) = split (/-/, $borrower->{'dateexpiry'}); + my ( $enrol_year, $enrol_month, $enrol_day) = split (/-/, $borrower->{'dateenrolled'}); # Renew day is calculated by adding the enrolment period to today my ( $renew_year, $renew_month, $renew_day); if ($enrol_year*$enrol_month*$enrol_day>0) { @@ -622,10 +622,6 @@ if($lib_messages_loop){ $template->param(flagged => 1 ); } my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch ); if($bor_messages_loop){ $template->param(flagged => 1 ); } -# Computes full borrower address -my (undef, $roadttype_hashref) = &GetRoadTypes(); -my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; - my $fast_cataloging = 0; if (defined getframeworkinfo('FA')) { $fast_cataloging = 1 @@ -646,9 +642,7 @@ $template->param( surname => $borrower->{'surname'}, dateexpiry => format_date($newexpiry), expiry => format_date($borrower->{'dateexpiry'}), - categorycode => $borrower->{'categorycode'}, categoryname => $borrower->{description}, - address => $address, address2 => $borrower->{'address2'}, email => $borrower->{'email'}, emailpro => $borrower->{'emailpro'}, @@ -657,7 +651,6 @@ $template->param( zipcode => $borrower->{'zipcode'}, country => $borrower->{'country'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, - cardnumber => $borrower->{'cardnumber'}, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, @@ -680,6 +673,8 @@ $template->param( fast_cataloging => $fast_cataloging, ); +SetMemberInfosInTemplate($borrowernumber, $template); + # save stickyduedate to session if ($stickyduedate) { $session->param( 'stickyduedate', $duedatespec ); diff --git a/installer/data/mysql/atomicupdate/0009-patron-attr-display-checkout.pl b/installer/data/mysql/atomicupdate/0009-patron-attr-display-checkout.pl new file mode 100644 index 0000000..44cfcfa --- /dev/null +++ b/installer/data/mysql/atomicupdate/0009-patron-attr-display-checkout.pl @@ -0,0 +1,7 @@ +#! /usr/bin/perl +use strict; +use warnings; +use C4::Context; +my $dbh=C4::Context->dbh; +$dbh->do("ALTER TABLE borrower_attribute_types ADD COLUMN `display_checkout` TINYINT(1) NOT NULL DEFAULT '0';"); +print "Upgrade done (Added a display_checkout field in borrower_attribute_types table)\n"; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e0bea81..b667cb3 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -281,6 +281,7 @@ CREATE TABLE `borrower_attribute_types` ( `password_allowed` tinyint(1) NOT NULL default 0, `staff_searchable` tinyint(1) NOT NULL default 0, `authorised_value_category` varchar(10) default NULL, + `display_checkout` tinyint(1) NOT NULL default 0, PRIMARY KEY (`code`), KEY `auth_val_cat_idx` (`authorised_value_category`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index c211507..b9f18f3 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -1924,6 +1924,38 @@ ul.budget_hierarchy li:last-child:after { ul.budget_hierarchy li:first-child:after { content: ""; } +#cartmenulink img { + background-image : none; + display : inline; + padding : 3px 6px 0 0; +} + +* html #cartmenulink { + border : 1px solid #336600; +} + +* html #listsmenulink { + border : 1px solid #006699; +} + +#collapsedaddress { + border: solid 1px #eee; + margin-right: 10px; + overflow: hidden; +} +#toggleaddress { + display: block; + padding: 2px 2px 2px 12px; + margin-right: 10px; + cursor: pointer; +} +.toggleaddress { + background: #eee url(../../img/more-right-arrow.gif) 0 50% no-repeat; +} +.toggleaddress2 { + background: #eee url(../../img/more-up-arrow.gif) 0 50% no-repeat; +} + .holdcount { font-size : 105%; line-height : 200%; } .holdcount a { border : 1px solid #a4bedd; background-color : #e4ecf5; font-weight : bold; -moz-border-radius: 4px; padding : .1em .4em; text-decoration : none; } .holdcount a:hover { background-color : #ebeff7; } @@ -1988,4 +2020,4 @@ fieldset.rows+h3 {clear:both;padding-top:.5em;} .importing .importing_msg { padding-left: 10px; padding-bottom: 10px; -} \ No newline at end of file +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 56dd2f2..28c0841 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -4,6 +4,19 @@ + +
  • ()
  • +
  • + + + + : + + + +
  • +
    +

    + + + + No address stored. + + + + + + + + , + + No city stored. + +

    +

    + + + + + + + + + + No phone stored. + + + +

    + + " title=""> + + + " title=""> + + No email stored. + + +

    +
    + View/Hide address +
  • + +