From d08d9e3fb7d0dcb083f79f111d63f8c320b17e27 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 7 May 2008 11:04:14 +0200 Subject: [PATCH] Addressing bug 1782 Adding New Systempreference AddPatronLists This systempreference allow administrator to choose if patrons are created on categorycode lists or category_type ones. Overloading GetBorrowerCategory so that if no parameter provided, it returns the list of category records Changing memberentry.pl in order to use the categorycode when provided. Bug Fixing Circulation.pl so that doesnot come up with Error 500 with no category selected for GetBorrowerCategory Signed-off-by: Joshua Ferraro --- C4/Members.pm | 39 +++-- admin/systempreferences.pl | 1 + circ/circulation.pl | 162 +++++++++++---------- installer/data/mysql/en/mandatory/sysprefs.sql | 2 +- .../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 12 +- .../prog/en/includes/patron-toolbar.inc | 17 ++- .../prog/en/modules/admin/authorised_values.tmpl | 1 + members/member.pl | 11 +- members/memberentry.pl | 4 +- members/members-home.pl | 10 +- 11 files changed, 156 insertions(+), 104 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 72c8770dfc..18ca449cf0 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1335,23 +1335,40 @@ sub GetborCatFromCatType { Given the borrower's category code, the function returns the corresponding data hashref for a comprehensive information display. + + $arrayref_hashref = &GetBorrowercategory; +If no category code provided, the function returns all the categories. =cut sub GetBorrowercategory { my ($catcode) = @_; my $dbh = C4::Context->dbh; - my $sth = - $dbh->prepare( -"SELECT description,dateofbirthrequired,upperagelimit,category_type - FROM categories - WHERE categorycode = ?" - ); - $sth->execute($catcode); - my $data = - $sth->fetchrow_hashref; - $sth->finish(); - return $data; + if ($catcode){ + my $sth = + $dbh->prepare( + "SELECT description,dateofbirthrequired,upperagelimit,category_type + FROM categories + WHERE categorycode = ?" + ); + $sth->execute($catcode); + my $data = + $sth->fetchrow_hashref; + $sth->finish(); + return $data; + } + else { + my $sth = + $dbh->prepare( + "SELECT * + FROM categories order by description" + ); + $sth->execute; + my $data = + $sth->fetchall_arrayref({}); + $sth->finish(); + return $data; + } } # sub getborrowercategory =head2 ethnicitycategories diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 76a08d27e2..decbd77270 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -173,6 +173,7 @@ my %tabsysprefs; $tabsysprefs{NoReturnSetLost}="Patrons"; $tabsysprefs{MaxFine}="Patrons"; $tabsysprefs{NotifyBorrowerDeparture}="Patrons"; + $tabsysprefs{AddPatronLists}="Patrons"; $tabsysprefs{PatronsPerPage}="Patrons"; # I18N/L10N diff --git a/circ/circulation.pl b/circ/circulation.pl index 390370d0aa..5fb86c3126 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -68,20 +68,20 @@ if ($branch){ my $printer = $query->param('printer'); if ($printer){ # update our session so the userenv is updated - my $dbh=C4::Context->dbh; - my $sessionID = $query->cookie("CGISESSID") ; - my $session = get_session($sessionID); - $session->param('branchprinter',$printer); + my $dbh=C4::Context->dbh; + my $sessionID = $query->cookie("CGISESSID") ; + my $session = get_session($sessionID); + $session->param('branchprinter',$printer); } if (!C4::Context->userenv && !$branch){ - my $sessionID = $query->cookie("CGISESSID") ; - my $session = get_session($sessionID); - if ($session->param('branch') eq 'NO_LIBRARY_SET'){ - # no branch set we can't issue - print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl"); - exit; - } + my $sessionID = $query->cookie("CGISESSID") ; + my $session = get_session($sessionID); + if ($session->param('branch') eq 'NO_LIBRARY_SET'){ + # no branch set we can't issue + print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl"); + exit; + } } my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( @@ -106,7 +106,7 @@ $findborrower =~ s|,| |g; #$findborrower =~ s|'| |g; my $borrowernumber = $query->param('borrowernumber'); -$branch = C4::Context->userenv->{'branch'}; +$branch = C4::Context->userenv->{'branch'}; $printer = C4::Context->userenv->{'branchprinter'}; @@ -143,8 +143,8 @@ my $newexpiry = $query->param('dateexpiry'); my ($datedue,$invalidduedate); if ($duedatespec) { - $datedue = C4::Dates->new($duedatespec); - $invalidduedate=1 unless $datedue; + $datedue = C4::Dates->new($duedatespec); + $invalidduedate=1 unless $datedue; } #if (defined($year)) { @@ -223,24 +223,24 @@ if ($borrowernumber) { { #borrowercard expired, no issues $template->param( - flagged => "1", + flagged => "1", noissues => "1", expired => format_date($borrower->{dateexpiry}), renewaldate => format_date("$renew_year-$renew_month-$renew_day") ); } # check for NotifyBorrowerDeparture - elsif ( C4::Context->preference('NotifyBorrowerDeparture') && - Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) < - Date_to_Days( $today_year, $today_month, $today_day ) ) - { - # borrower card soon to expire warn librarian - $template->param("warndeparture" => format_date($borrower->{dateexpiry}), - flagged => "1",); - if ( C4::Context->preference('ReturnBeforeExpiry')){ - $template->param("returnbeforeexpiry" => 1); - } - } + elsif ( C4::Context->preference('NotifyBorrowerDeparture') && + Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) < + Date_to_Days( $today_year, $today_month, $today_day ) ) + { + # borrower card soon to expire warn librarian + $template->param("warndeparture" => format_date($borrower->{dateexpiry}), + flagged => "1",); + if ( C4::Context->preference('ReturnBeforeExpiry')){ + $template->param("returnbeforeexpiry" => 1); + } + } $template->param( overduecount => $od, issuecount => $issue, @@ -254,11 +254,11 @@ if ($borrowernumber) { # if ($barcode) { - # always check for blockers on issuing - my ( $error, $question ) = - CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess ); - my $noerror = 1; - foreach my $impossible ( keys %$error ) { + # always check for blockers on issuing + my ( $error, $question ) = + CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess ); + my $noerror = 1; + foreach my $impossible ( keys %$error ) { $template->param( $impossible => $$error{$impossible}, IMPOSSIBLE => 1 @@ -266,17 +266,17 @@ if ($barcode) { $noerror = 0; } - if ($issueconfirmed && $noerror) { - # we have no blockers for issuing and any issues needing confirmation have been resolved + if ($issueconfirmed && $noerror) { + # we have no blockers for issuing and any issues needing confirmation have been resolved AddIssue( $borrower, $barcode, $datedue, $cancelreserve ); $inprocess = 1; } - elsif ($issueconfirmed){ - } + elsif ($issueconfirmed){ + } else { my $noquestion = 1; # Get the item title for more information - my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); + my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); foreach my $needsconfirmation ( keys %$question ) { $template->param( @@ -287,8 +287,8 @@ if ($barcode) { $noquestion = 0; } $template->param( - itemhomebranch => $getmessageiteminfo->{'homebranch'} , - duedatespec => $duedatespec, + itemhomebranch => $getmessageiteminfo->{'homebranch'} , + duedatespec => $duedatespec, ); if ( $noerror && ( $noquestion || $issueconfirmed ) ) { AddIssue( $borrower, $barcode, $datedue ); @@ -311,6 +311,8 @@ if ($borrowernumber) { ################################################################################## # BUILD HTML # show all reserves of this borrower, and the position of the reservation .... +my $borrowercategory; +my $category_type; if ($borrowernumber) { # new op dev @@ -337,8 +339,8 @@ if ($borrowernumber) { $getreserv{author} = $getiteminfo->{'author'}; $getreserv{barcodereserv} = $getiteminfo->{'barcode'}; $getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'}; - $getreserv{biblionumber} = $getiteminfo->{'biblionumber'}; - $getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} ); + $getreserv{biblionumber} = $getiteminfo->{'biblionumber'}; + $getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} ); # check if we have a waiting status for reservations if ( $num_res->{'found'} eq 'W' ) { $getreserv{color} = 'reserved'; @@ -350,7 +352,7 @@ if ($borrowernumber) { $getWaitingReserveInfo{author} = $getiteminfo->{'author'}; $getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} ); $getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} ); - if($num_res->{'branchcode'} eq $branch){ $getWaitingReserveInfo{waitinghere} = 1; } + if($num_res->{'branchcode'} eq $branch){ $getWaitingReserveInfo{waitinghere} = 1; } } # check transfers with the itemnumber foud in th reservation loop if ($transfertwhen) { @@ -378,7 +380,7 @@ if ($borrowernumber) { $getreserv{nottransfered} = 0; $getreserv{itemtype} = $getbibtype->{'description'}; $getreserv{author} = $getbibinfo->{'author'}; - $getreserv{biblionumber} = $num_res->{'biblionumber'}; + $getreserv{biblionumber} = $num_res->{'biblionumber'}; } push( @reservloop, \%getreserv ); @@ -395,6 +397,9 @@ if ($borrowernumber) { reservloop => \@reservloop , WaitingReserveLoop => \@WaitingReserveLoop, ); + $borrowercategory = GetBorrowercategory( $borrower->{'categorycode'} ); + $category_type = $borrowercategory->{'category_type'}; + ( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' ); } # make the issued books table. @@ -424,22 +429,22 @@ if ($borrower) { my $issuedate = $it->{'issuedate'}; $issuedate =~ s/-//g; $issuedate = substr( $issuedate, 0, 8 ); - ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges( - $it->{'itemnumber'}, $borrower->{'borrowernumber'} - ); - $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); + ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges( + $it->{'itemnumber'}, $borrower->{'borrowernumber'} + ); + $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); my $can_renew_error; ($it->{'can_renew'}, $can_renew_error) = CanBookBeRenewed( - $borrower->{'borrowernumber'},$it->{'itemnumber'} - ); + $borrower->{'borrowernumber'},$it->{'itemnumber'} + ); $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error; - my ($restype, $reserves) = CheckReserves($it->{'itemnumber'}); - ($restype) and $it->{'can_renew'} = 0; + my ($restype, $reserves) = CheckReserves($it->{'itemnumber'}); + ($restype) and $it->{'can_renew'} = 0; - $it->{'dd'} = format_date($it->{'date_due'}); + $it->{'dd'} = format_date($it->{'date_due'}); my $datedue = $it->{'date_due'}; $datedue =~ s/-//g; - $it->{'od'} = ($datedue < $todaysdate) ? 1 : 0 ; + $it->{'od'} = ($datedue < $todaysdate) ? 1 : 0 ; ($it->{'author'} eq '') and $it->{'author'} = ' '; $it->{'renew_failed'} = $renew_failed[$it->{'itemnumber'}]; # ADDED BY JF: NEW ITEMTYPE COUNT DISPLAY @@ -451,24 +456,24 @@ if ($borrower) { push @previousissues, $it; } } - if (C4::Context->preference("todaysIssuesDefaultSortOrder") eq 'asc'){ - @todaysissues = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues; - } - else { - @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues; - } - if (C4::Context->preference("previousIssuesDefaultSortOrder") eq 'asc'){ - @previousissues = sort { $a->{'date_due' } cmp $b->{'date_due' } } @previousissues; - } - else { - @previousissues = sort { $b->{'date_due' } cmp $a->{'date_due' } } @previousissues; - } + if (C4::Context->preference("todaysIssuesDefaultSortOrder") eq 'asc'){ + @todaysissues = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues; + } + else { + @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues; + } + if (C4::Context->preference("previousIssuesDefaultSortOrder") eq 'asc'){ + @previousissues = sort { $a->{'date_due' } cmp $b->{'date_due' } } @previousissues; + } + else { + @previousissues = sort { $b->{'date_due' } cmp $a->{'date_due' } } @previousissues; + } my $i = 1; - foreach my $book (@todaysissues) { + foreach my $book (@todaysissues) { $book->{'togglecolor'} = (++$i % 2) ? 0 : 1 ; } $i = 1; - foreach my $book (@previousissues) { + foreach my $book (@previousissues) { $book->{'togglecolor'} = (++$i % 2) ? 0 : 1 ; } } @@ -528,8 +533,8 @@ if ($borrowerslist) { } $CGIselectborrower = CGI::scrolling_list( -name => 'borrowernumber', - -class => 'focus', - -id => 'borrowernumber', + -class => 'focus', + -id => 'borrowernumber', -values => \@values, -labels => \%labels, -size => 7, @@ -642,9 +647,6 @@ if ( C4::Context->preference("memberofinstitution") ) { $amountold = $temp[1]; -my $borrowercategory = GetBorrowercategory( $borrower->{'categorycode'} ); -my $category_type = $borrowercategory->{'category_type'}; -( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' ); $template->param( issued_itemtypes_count_loop => $issued_itemtypes_loop, @@ -652,19 +654,19 @@ $template->param( borrower => $borrower, borrowernumber => $borrowernumber, branch => $branch, - branchname => GetBranchName($branch), + branchname => GetBranchName($borrower->{'branchcode'}), printer => $printer, printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, - dateexpiry => format_date($newexpiry), - expiry => format_date($borrower->{'dateexpiry'}), + dateexpiry => format_date($newexpiry), + expiry => format_date($borrower->{'dateexpiry'}), categorycode => $borrower->{'categorycode'}, categoryname => $borrowercategory->{description}, - address => $borrower->{'address'}, - address2 => $borrower->{'address2'}, - email => $borrower->{'email'}, - emailpro => $borrower->{'emailpro'}, + address => $borrower->{'address'}, + address2 => $borrower->{'address2'}, + email => $borrower->{'email'}, + emailpro => $borrower->{'emailpro'}, borrowernotes => $borrower->{'borrowernotes'}, city => $borrower->{'city'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, @@ -679,8 +681,8 @@ $template->param( inprocess => $inprocess, memberofinstution => $member_of_institution, CGIorganisations => $CGIorganisations, - circview => 1, - + circview => 1, + ); # set return date if stickyduedate diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index 1c4c1f28f7..64c7582895 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -179,7 +179,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:MaxCount','50','OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries',NULL,'Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:Set','SET,Experimental set\r\nSET:SUBSET,Experimental subset','OAI-PMH exported set, the set name is followed by a comma and a short description, one set by line',NULL,'Free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:Subset','itemtype=\'BOOK\'','Restrict answer to matching raws of the biblioitems table (experimental)',NULL,'Free'); - INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GranularPermissions','0','Use detailed staff user permissions',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index d4233286d9..bf5eb5b152 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -184,3 +184,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Si activé, les adhérents peuvent placer des réservations sur un exemplaire spécifique. Sinon, il ne peuvent que réserver le prochain disponible.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GranularPermissions','0','Use detailed staff user permissions',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Slectionner categorycode ou category_type permet d\'afficher la liste des catégories ou des types de catégories à l\'ajout d\'un lecteur'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 74790d9ccb..d080d49988 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1279,7 +1279,6 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (adding permissions and user_permissions tables and GranularPermissions syspref) \n"; SetVersion ($DBversion); } - $DBversion = "3.00.00.069"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("ALTER TABLE labels_conf CHANGE COLUMN class classification int(1) DEFAULT NULL;"); @@ -1479,6 +1478,17 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.00.00.079"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + my ($print_error) = $dbh->{PrintError}; + $dbh->{PrintError} = 0; + + $dbh->do("INSERT INTO `systempreferences` (variable, value,options,type, explanation)VALUES + ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons')"); + print "Upgrade to $DBversion done (add browser table if not already present)\n"; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc index ad572f9a79..1baeee2a1e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc @@ -5,11 +5,14 @@ // prepare DOM for YUI Toolbar $(document).ready(function() { + + $("#addchild").parent().remove(); $("#addprofessional").parent().remove(); $("#addorganisation").parent().remove(); $("#addstaff").parent().remove(); $("#addstatistical").parent().remove(); + $("#newmenuc").empty(); yuiToolbar(); }); @@ -19,12 +22,16 @@ function yuiToolbar() { var newmenu = [ + +{ text: "", url: "/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=" }, + { text: _("Adult Patron"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&category_type=A" }, { text: _("Child Patron"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&category_type=C" }, { text: _("Professional Patron"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&category_type=P" }, { text: _("Organisation"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&category_type=I" }, { text: _("Staff"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&category_type=S" }, { text: _("Statistical"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&category_type=X" }, + ] new YAHOO.widget.Button({ @@ -40,10 +47,6 @@ //]]> +
  • + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl index f51a668001..b82b6e9287 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tmpl @@ -40,6 +40,7 @@
  • + " /> " />
  • diff --git a/members/member.pl b/members/member.pl index dc3da69092..1d33191a74 100755 --- a/members/member.pl +++ b/members/member.pl @@ -55,6 +55,16 @@ if($quicksearch){ }); } my $theme = $input->param('theme') || "default"; + + +$template->param( + "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1", + ); +if (C4::Context->preference("AddPatronLists")=~/code/){ + my $categories=GetBorrowercategory(); + $categories->[0]->{'first'}=1; + $template->param(categories=>$categories); +} # only used if allowthemeoverride is set #my %tmpldata = pathtotemplate ( template => 'member.tmpl', theme => $theme, language => 'fi' ); # FIXME - Error-checking @@ -62,7 +72,6 @@ my $theme = $input->param('theme') || "default"; # die_on_bad_params => 0, # loop_context_vars => 1 ); - my $member=$input->param('member'); my $orderby=$input->param('orderby'); $orderby = "surname,firstname" unless $orderby; diff --git a/members/memberentry.pl b/members/memberentry.pl index 5cc8c004e0..4619fcc514 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -301,14 +301,14 @@ if ($ethnicitycategoriescount>=0) { } my @typeloop; -foreach ( ($new_c_type) ? ($new_c_type) : qw(C A S P I X)){ +foreach ( ($category_type) ? ($category_type) : qw(C A S P I X)){ my $action="WHERE category_type=?"; ($categories,$labels)=GetborCatFromCatType($_,$action); my @categoryloop; foreach my $cat (@$categories){ push @categoryloop,{'categorycode' => $cat, 'categoryname' => $labels->{$cat}, - 'categorycodeselected' => ($cat eq $borrower_data->{'categorycode'}), + 'categorycodeselected' => ($cat eq $borrower_data->{'categorycode'} || $cat eq $categorycode), }; } my %typehash; diff --git a/members/members-home.pl b/members/members-home.pl index a5f6c8ed9c..212c97b17b 100755 --- a/members/members-home.pl +++ b/members/members-home.pl @@ -20,7 +20,7 @@ use CGI; use C4::Auth; use C4::Output; use C4::Context; - +use C4::Members; my $query = new CGI; my $quicksearch = $query->param('quicksearch'); @@ -46,5 +46,13 @@ if($quicksearch){ debug => 1, }); } +$template->param( + "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1", + ); +if (C4::Context->preference("AddPatronLists")=~/code/){ + my $categories=GetBorrowercategory(); + $categories->[0]->{'first'}=1; + $template->param(categories=>$categories); +} output_html_with_http_headers $query, $cookie, $template->output; -- 2.11.0