From srdjan at catalyst.net.nz Wed May 2 07:56:53 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Wed, 2 May 2012 17:56:53 +1200 Subject: [Koha-patches] [PATCH] bug_8034: Restored network printer maintenance and selection In-Reply-To: References: Message-ID: <1335938213-5761-1-git-send-email-srdjan@catalyst.net.nz> This patch is just for restoring printer maintenance and selection, not for priting itself. It is just a preparation step. * Added UsePrintQueues syspref. If set to No, no printer info will be displayed/used * Database changes: - printers table PRIMARY KEY is now printqueue. It is more natural. We should really have a synthetic id, but printqueue is good enough - branches.branchprinter is a FOREIGN KEY to printers.printqueue * Created C4::Auth::get_user_printer() function that will return appropriate printer. In order of preference: - session selected - logged in branch branchprinter * Created C4::Koha::GetPrinterDetails($printqueue) * Restored printer maint/selection in admin zone UsePrintQueues permitting * Restored printer selection in circ/selectbranchprinter.pl UsePrintQueues permitting --- C4/Auth.pm | 49 ++++++++++++++++---- C4/Context.pm | 2 +- C4/Koha.pm | 15 +++++- C4/Members.pm | 1 - admin/branches.pl | 29 +++++++----- admin/printers.pl | 13 +++--- circ/circulation.pl | 10 ---- circ/returns.pl | 8 ---- circ/selectbranchprinter.pl | 15 +++--- installer/data/mysql/kohastructure.sql | 18 +++---- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 13 ++++++ .../intranet-tmpl/prog/en/includes/header.inc | 3 ++ .../prog/en/modules/admin/admin-home.tt | 4 +- .../prog/en/modules/admin/branches.tt | 20 ++++---- .../en/modules/admin/preferences/circulation.pref | 6 +++ .../prog/en/modules/admin/printers.tt | 13 ++---- .../prog/en/modules/circ/circulation.tt | 2 - .../prog/en/modules/circ/selectbranchprinter.tt | 5 +- 19 files changed, 140 insertions(+), 87 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index ffee1bb..9ab1942 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -26,6 +26,7 @@ use CGI::Session; require Exporter; use C4::Context; +use C4::Koha; use C4::Templates; # to get the template use C4::Branch; # GetBranches use C4::VirtualShelves; @@ -45,7 +46,8 @@ BEGIN { $debug = $ENV{DEBUG}; @ISA = qw(Exporter); @EXPORT = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions); - @EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &get_all_subpermissions &get_user_subpermissions); + @EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw + &get_all_subpermissions &get_user_subpermissions &get_user_printer); %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); $ldap = C4::Context->config('useldapserver') || 0; $cas = C4::Context->preference('casAuthentication'); @@ -309,6 +311,9 @@ sub get_template_and_user { $template->param(dateformat_iso => 1); } + my $userenv = C4::Context->userenv; + my $userenv_branch = $userenv ? $userenv->{"branch"} : undef; + # these template parameters are set the same regardless of $in->{'type'} $template->param( "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, @@ -316,9 +321,9 @@ sub get_template_and_user { GoogleJackets => C4::Context->preference("GoogleJackets"), OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"), KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"), - LoginBranchcode => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"), - LoginFirstname => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"), - LoginSurname => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu", + LoginBranchcode => ($userenv?$userenv_branch:"insecure"), + LoginFirstname => ($userenv?$userenv->{"firstname"}:"Bel"), + LoginSurname => $userenv?$userenv->{"surname"}:"Inconnu", TagsEnabled => C4::Context->preference("TagsEnabled"), hide_marc => C4::Context->preference("hide_marc"), item_level_itypes => C4::Context->preference('item-level_itypes'), @@ -345,7 +350,7 @@ sub get_template_and_user { IntranetNav => C4::Context->preference("IntranetNav"), IntranetmainUserblock => C4::Context->preference("IntranetmainUserblock"), LibraryName => C4::Context->preference("LibraryName"), - LoginBranchname => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"), + LoginBranchname => ($userenv?$userenv->{"branchname"}:"insecure"), advancedMARCEditor => C4::Context->preference("advancedMARCEditor"), canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'), intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), @@ -364,6 +369,14 @@ sub get_template_and_user { OPACLocalCoverImages => C4::Context->preference('OPACLocalCoverImages'), AllowMultipleCovers => C4::Context->preference('AllowMultipleCovers'), ); + if ( C4::Context->preference('UsePrintQueues') ) { + my $printer = get_user_printer(); + my $printer_rec = $printer ? GetPrinterDetails($printer) : {}; + $template->param( + UsePrintQueues => 1, + PrinterName => $printer_rec->{printername}, + ); + } } else { warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' ); @@ -382,8 +395,8 @@ sub get_template_and_user { my $opac_name = ''; if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $in->{'query'}->param('limit') =~ /branch:(\w+)/){ $opac_name = $1; # opac_search_limit is a branch, so we use it. - } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) { - $opac_name = C4::Context->userenv->{'branch'}; + } elsif (C4::Context->preference("SearchMyLibraryFirst") && $userenv_branch) { + $opac_name = $userenv_branch } my $checkstyle = C4::Context->preference("opaccolorstylesheet"); if ($checkstyle =~ /http/) @@ -402,7 +415,7 @@ sub get_template_and_user { CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1, LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, - LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"", + LoginBranchname => $userenv?$userenv->{"branchname"}:"", OPACAmazonEnabled => C4::Context->preference("OPACAmazonEnabled"), OPACAmazonSimilarItems => C4::Context->preference("OPACAmazonSimilarItems"), OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"), @@ -435,7 +448,7 @@ sub get_template_and_user { RequestOnOpac => C4::Context->preference("RequestOnOpac"), 'Version' => C4::Context->preference('Version'), hidelostitems => C4::Context->preference("hidelostitems"), - mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '', + mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst") && $userenv) ? $userenv_branch : '', opaclayoutstylesheet => "" . C4::Context->preference("opaclayoutstylesheet"), opacstylesheet => "" . C4::Context->preference("opacstylesheet"), opacbookbag => "" . C4::Context->preference("opacbookbag"), @@ -1664,8 +1677,24 @@ sub getborrowernumber { return 0; } +=head2 get_user_printer + + $printer = get_user_printer(); + + Returns printer queue that is to be used for the logged in user + +=cut + +sub get_user_printer { + my $userenv = C4::Context->userenv or return; + if (my $printer = $userenv->{branchprinter}) { + return $printer; + } + my $branchname = $userenv->{branch} or return; + my $branch = GetBranchDetail($branchname) or return; + return $branch->{branchprinter}; +} -END { } # module clean-up code here (global destructor) 1; __END__ diff --git a/C4/Context.pm b/C4/Context.pm index 67d31ee..32c15aa 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -998,7 +998,7 @@ sub userenv { =head2 set_userenv C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, - $usersurname, $userbranch, $userflags, $emailaddress); + $usersurname, $userbranch, $userflags, $emailaddress, $branchprinter); Establish a hash of user environment variables. diff --git a/C4/Koha.pm b/C4/Koha.pm index 0192989..c60495e 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -34,7 +34,7 @@ BEGIN { @EXPORT = qw( &slashifyDate &subfield_is_koha_internal_p - &GetPrinters &GetPrinter + &GetPrinters &GetPrinter &GetPrinterDetails &GetItemTypes &getitemtypeinfo &GetCcodes &GetSupportName &GetSupportList @@ -633,6 +633,19 @@ sub GetPrinter ($$) { return $printer; } +=head2 GetPrinterDetails + + $printer_rec = GetPrinterDetails( $printqueue ); + +=cut + +sub GetPrinterDetails { + my ( $printer ) = @_; + my $dbh = C4::Context->dbh; + my $printername = $dbh->selectrow_hashref('SELECT * FROM printers WHERE printqueue = ?', undef, $printer); + return $printername; +} + =head2 getnbpages Returns the number of pages to display in a pagination bar, given the number diff --git a/C4/Members.pm b/C4/Members.pm index 6161ac9..693e0ba 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -997,7 +997,6 @@ sub GetPendingIssues { # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance # FIXME: namespace collision: each table has "timestamp" fields. Which one is "timestamp" ? # FIXME: circ/ciculation.pl tries to sort by timestamp! - # FIXME: C4::Print::printslip tries to sort by timestamp! # FIXME: namespace collision: other collisions possible. # FIXME: most of this data isn't really being used by callers. my $query = diff --git a/admin/branches.pl b/admin/branches.pl index c12762d..2b4c982 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -226,12 +226,9 @@ sub default { sub editbranchform { my ($branchcode,$innertemplate) = @_; - # initiate the scrolling-list to select the printers - my $printers = GetPrinters(); - my @printerloop; + my $data; my $oldprinter = ""; - if ($branchcode) { $data = GetBranchInfo($branchcode); $data = $data->[0]; @@ -241,15 +238,21 @@ sub editbranchform { _branch_to_template($data, $innertemplate); } - foreach my $thisprinter ( keys %$printers ) { - push @printerloop, { - value => $thisprinter, - selected => ( $oldprinter eq $printers->{$thisprinter} ), - branchprinter => $printers->{$thisprinter}->{'printqueue'}, - }; + if ( C4::Context->preference('UsePrintQueues') ) { + # initiate the scrolling-list to select the printers + my $printers = GetPrinters(); + my @printerloop; + foreach my $thisprinter ( keys %$printers ) { + push @printerloop, { + value => $thisprinter, + selected => ( $oldprinter eq $printers->{$thisprinter} ), + branchprinter => $printers->{$thisprinter}->{'printername'}, + }; + } + + $innertemplate->param( printerloop => \@printerloop ); } - $innertemplate->param( printerloop => \@printerloop ); # make the checkboxes..... # # We export a "categoryloop" array to the template, each element of which @@ -308,6 +311,7 @@ sub branchinfotable { my ($branchcode,$innertemplate) = @_; my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo(); + my $printers = GetPrinters(); my @loop_data = (); foreach my $branch (@$branchinfo) { # @@ -367,6 +371,9 @@ sub branchinfotable { $row{'branch_name'} = $branch->{'branchname'}; $row{'branch_code'} = $branch->{'branchcode'}; $row{'value'} = $branch->{'branchcode'}; + if (my $printer = $branch->{'branchprinter'}) { + $row{'branchprintername'} = $printers->{$printer}->{'printername'}; + } push @loop_data, \%row; } diff --git a/admin/printers.pl b/admin/printers.pl index c32b4e6..a81e3ab 100755 --- a/admin/printers.pl +++ b/admin/printers.pl @@ -89,12 +89,13 @@ if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($searchfield) { - my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printername=?"); + my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printqueue=?"); $sth->execute($searchfield); $data=$sth->fetchrow_hashref; } $template->param(printqueue => $data->{'printqueue'}, + printername => $data->{'printername'}, printtype => $data->{'printtype'}); # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## @@ -105,15 +106,15 @@ if ($op eq 'add_form') { my $sth=$dbh->prepare("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)"); $sth->execute($input->param('printername'),$input->param('printqueue'),$input->param('printtype')); } else { - my $sth=$dbh->prepare("UPDATE printers SET printqueue=?,printtype=? WHERE printername=?"); - $sth->execute($input->param('printqueue'),$input->param('printtype'),$input->param('printername')); + my $sth=$dbh->prepare("UPDATE printers SET printername=?,printqueue=?,printtype=? WHERE printqueue=?"); + $sth->execute($input->param('printername'),$input->param('printqueue'),$input->param('printtype'),$searchfield); } # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { $template->param(delete_confirm => 1); - my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printername=?"); + my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printqueue=?"); $sth->execute($searchfield); my $data=$sth->fetchrow_hashref; $template->param(printqueue => $data->{'printqueue'}, @@ -123,7 +124,7 @@ if ($op eq 'add_form') { # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { $template->param(delete_confirmed => 1); - my $sth=$dbh->prepare("delete from printers where printername=?"); + my $sth=$dbh->prepare("delete from printers where printqueue=?"); $sth->execute($searchfield); # END $OP eq DELETE_CONFIRMED ################## DEFAULT ########################################### @@ -131,7 +132,7 @@ if ($op eq 'add_form') { $template->param(else => 1); my ($count,$results)=StringSearch($searchfield,'web'); my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count; - my @loop = (@$results)[$offset..$max]; + my @loop = (@$results)[$offset..$max-1]; $template->param(loop => \@loop); diff --git a/circ/circulation.pl b/circ/circulation.pl index bcbcb6f..4815879 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -66,12 +66,6 @@ if ($branch){ $session->param('branchname', GetBranchName($branch)); } -my $printer = $query->param('printer'); -if ($printer){ - # update our session so the userenv is updated - $session->param('branchprinter', $printer); -} - if (!C4::Context->userenv && !$branch){ if ($session->param('branch') eq 'NO_LIBRARY_SET'){ # no branch set we can't issue @@ -101,8 +95,6 @@ $findborrower =~ s|,| |g; my $borrowernumber = $query->param('borrowernumber'); $branch = C4::Context->userenv->{'branch'}; -$printer = C4::Context->userenv->{'branchprinter'}; - # If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian if (C4::Context->preference("AutoLocation") != 1) { @@ -661,8 +653,6 @@ $template->param( borrowernumber => $borrowernumber, branch => $branch, branchname => GetBranchName($borrower->{'branchcode'}), - printer => $printer, - printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, showname => $borrower->{'showname'}, diff --git a/circ/returns.pl b/circ/returns.pl index bd60d42..0add27d 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -36,7 +36,6 @@ use C4::Context; use C4::Auth qw/:DEFAULT get_session/; use C4::Output; use C4::Circulation; -use C4::Print; use C4::Reserves; use C4::Biblio; use C4::Items; @@ -73,15 +72,10 @@ my ( $template, $librarian, $cookie ) = get_template_and_user( ##################### #Global vars my $branches = GetBranches(); -my $printers = GetPrinters(); -my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : ""; my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off'); my $userenv_branch = C4::Context->userenv->{'branch'} || ''; -# -# Some code to handle the error if there is no branch or printer setting..... -# # Set up the item stack .... my %returneditems; @@ -605,9 +599,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $template->param( riloop => \@riloop, genbrname => $branches->{$userenv_branch}->{'branchname'}, - genprname => $printers->{$printer}->{'printername'}, branchname => $branches->{$userenv_branch}->{'branchname'}, - printer => $printer, errmsgloop => \@errmsgloop, exemptfine => $exemptfine, dropboxmode => $dropboxmode, diff --git a/circ/selectbranchprinter.pl b/circ/selectbranchprinter.pl index b5adcfc..9388deb 100755 --- a/circ/selectbranchprinter.pl +++ b/circ/selectbranchprinter.pl @@ -23,8 +23,7 @@ use CGI; use C4::Context; use C4::Output; -use C4::Auth qw/:DEFAULT get_session/; -use C4::Print; # GetPrinters +use C4::Auth qw/:DEFAULT get_session get_user_printer/; use C4::Koha; use C4::Branch; # GetBranches GetBranchesLoop @@ -56,9 +55,10 @@ my $userenv_printer = C4::Context->userenv->{'branchprinter'} || ''; my @updated; # $session lddines here are doing the updating -if ($branch and $branches->{$branch}) { +my $branch_rec = $branch ? $branches->{$branch} : undef; +if ($branch_rec) { if (! $userenv_branch or $userenv_branch ne $branch ) { - my $branchname = GetBranchName($branch); + my $branchname = $branch_rec->{branchname}; $template->param(LoginBranchname => $branchname); # update template for new branch $template->param(LoginBranchcode => $branch); # update template for new branch $session->param('branchname', $branchname); # update sesssion in DB @@ -67,6 +67,8 @@ if ($branch and $branches->{$branch}) { updated_branch => 1, old_branch => $userenv_branch, }; + $printer ||= $branch_rec->{branchprinter}; + undef $userenv_printer; } # else branch the same, no update } else { $branch = $userenv_branch; # fallback value @@ -87,7 +89,7 @@ if ($printer) { }; } # else printer is the same, no update } else { - $printer = $userenv_printer; # fallback value + $printer = get_user_printer(); # fallback value } $template->param(updated => \@updated) if (scalar @updated); @@ -96,14 +98,13 @@ unless ($branches->{$branch}) { $branch = (keys %$branches)[0]; # if branch didn't really exist, then replace it w/ one that does } -my @printkeys = sort keys %$printers; +my @printkeys = keys %$printers; if (scalar(@printkeys) == 1 or not $printers->{$printer}) { $printer = $printkeys[0]; # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does } my @printerloop; foreach ( @printkeys ) { - next unless ($_); # skip printer if blank. push @printerloop, { selected => ( $_ eq $printer ), name => $printers->{$_}->{'printername'}, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index a210293..af7c266 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -362,10 +362,11 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st `branchurl` mediumtext, -- the URL for your library or branch's website `issuing` tinyint(4) default NULL, -- unused in Koha `branchip` varchar(15) default NULL, -- the IP address for your library or branch - `branchprinter` varchar(100) default NULL, -- unused in Koha + `branchprinter` varchar(20) default NULL, `branchnotes` mediumtext, -- notes related to your library or branch opac_info text, -- HTML that displays in OPAC - UNIQUE KEY `branchcode` (`branchcode`) + UNIQUE KEY `branchcode` (`branchcode`), + FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1563,12 +1564,13 @@ CREATE TABLE `pending_offline_operations` ( -- Table structure for table `printers` -- -DROP TABLE IF EXISTS `printers`; -CREATE TABLE `printers` ( - `printername` varchar(40) NOT NULL default '', - `printqueue` varchar(20) default NULL, - `printtype` varchar(20) default NULL, - PRIMARY KEY (`printername`) +DROP TABLE IF EXISTS printers; +CREATE TABLE printers ( + printername varchar(40) NOT NULL default '', + printqueue varchar(20) NOT NULL, + printtype varchar(20) default NULL, + PRIMARY KEY (printqueue), + UNIQUE (printername) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..0d99e2d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -362,3 +362,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 84f0437..53b6e8b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,19 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } + + + +$DBversion = "3.08.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("ALTER TABLE printers DROP PRIMARY KEY, MODIFY printqueue varchar(20) NOT NULL PRIMARY KEY, ADD UNIQUE (printername)"); + $dbh->do("ALTER TABLE branches MODIFY branchprinter varchar(20) NULL, ADD FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo')"); + + print "Upgrade to $DBversion done (Add borrowers.default_printqueue and 'UsePrintQueues' syspref)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 4783523..019a15e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -57,6 +57,9 @@ [% LoginBranchname %] [% END %] + [% IF UsePrintQueues %] + - [% PrinterName %] + [% END %] [% IF ( IndependantBranches ) %] [% IF ( CAN_user_management || CAN_user_editcatalogue_edit_catalogue ) %] ( Set library ) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index ef46ede..0954a8c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -95,8 +95,8 @@
[% IF ( NoZebra ) %]
Stop words
Words ignored during search.
[% END %] - + [% IF UsePrintQueues %]
Network Printers
+
Printers (UNIX paths).
[% END %]
Z39.50 client targets
Define which servers to query for MARC data in the integrated Z39.50 client.
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index bedeb8b..da70a42 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -143,10 +143,10 @@ tinyMCE.init({
  • Can be entered as a single IP, or a subnet such as 192.168.1.*
  • - +[% END %]
  • @@ -198,7 +198,9 @@ tinyMCE.init({ Address Properties IP - +[% IF UsePrintQueues %] + Printer +[% END %]   [% FOREACH branche IN branches %] @@ -250,9 +252,11 @@ tinyMCE.init({ [% branche.branchip %] - +[% IF UsePrintQueues %] + + [% branche.branchprintername %] + +[% END %] Edit diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 471aa0e..d3b804b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -103,6 +103,12 @@ Circulation: - pref: NoticeCSS class: url - on Notices. (This should be a complete URL, starting with http://) + - + - pref: UsePrintQueues + choices: + yes: "Use" + no: "Don't use" + - server print queues. Checkout Policy: - - pref: AllowNotForLoanOverride diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt index 7dfb80b..887c715 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt @@ -89,22 +89,17 @@
    [% IF ( searchfield ) %] + [% ELSE %] [% END %]
    -
      [% IF ( searchfield ) %] -
    1. - Printer name: - [% searchfield %] -
    2. - [% ELSE %] +
      1. - +
      2. - [% END %]
      3. @@ -190,7 +185,7 @@ [% loo.printername %] [% loo.printqueue %] [% loo.printtype %] - Edit Delete + Edit Delete [% END %] [% ELSE %]
        No printers defined.
        [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index e79cef1..a736de8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -435,7 +435,6 @@ No patron matched [% message %] Patron selection - @@ -522,7 +521,6 @@ No patron matched [% message %] [% END %] - [% IF ( CHARGES ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt index acad21c..e742f81 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt @@ -28,7 +28,7 @@ Updated:
          [% IF ( update.updated_branch ) %]
        • Library: [% update.old_branch or "?" %] ⇒ [% update.LoginBranchcode or "?" %]
        • [% ELSIF ( update.updated_printer ) %] - +
        • Printer: [% update.old_printer or "?" %] ⇒ [% update.new_printer or "?" %]
        • [% ELSE %]
        • ERROR - unknown
        • [% END %] @@ -63,7 +63,6 @@ Updated:
            [% END %] [% END %] - + [% END %]
    -- 1.7.9.5 From amit.gupta at osslabs.biz Thu May 3 10:41:30 2012 From: amit.gupta at osslabs.biz (Amit Gupta) Date: Thu, 3 May 2012 14:11:30 +0530 Subject: [Koha-patches] [PATCH] Bug 7970 - Allow OPAC holds per library policy without default rule Message-ID: <1336034490-13206-1-git-send-email-amit.gupta@osslabs.biz> By default ReservesControlBranch systempreference is not inserting in systempreferences table. For this reason we have to set up default circulation rule for all libraries all itemtypes and all patron categories. After this we have to set only circulation rule by branch wise no need to set up for all libraries, itemtypes and patron categories. To Test: 1) Go to mysql use koha database 2) mysql> select * from systempreferences where variable = 'ReservesControlBranch'; +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ | variable | value | options | explanation | type | +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ | ReservesControlBranch | ItemHomeLibrary | ItemHomeLibrary|PatronLibrary | Patron can place a hold on the item. | Choice | +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..2dcb1a2 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -362,3 +362,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Patron can place a hold on the item.','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 84f0437..5d05b86 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.08.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Patron can place a hold on the item.','Choice')"); + print "Upgrade to $DBversion done (Insert ReservesControlBranch systempreference into systempreferences table ))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.6.4.2 From amit.gupta at osslabs.biz Thu May 3 10:41:30 2012 From: amit.gupta at osslabs.biz (Amit Gupta) Date: Thu, 3 May 2012 14:11:30 +0530 Subject: [Koha-patches] [PATCH] Bug 7970 - Allow OPAC holds per library policy without default rule Message-ID: <1336034490-13206-1-git-send-email-amit.gupta@osslabs.biz> By default ReservesControlBranch systempreference is not inserting in systempreferences table. For this reason we have to set up default circulation rule for all libraries all itemtypes and all patron categories. After this we have to set only circulation rule by branch wise no need to set up for all libraries, itemtypes and patron categories. To Test: 1) Go to mysql use koha database 2) mysql> select * from systempreferences where variable = 'ReservesControlBranch'; +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ | variable | value | options | explanation | type | +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ | ReservesControlBranch | ItemHomeLibrary | ItemHomeLibrary|PatronLibrary | Patron can place a hold on the item. | Choice | +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..2dcb1a2 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -362,3 +362,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Patron can place a hold on the item.','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 84f0437..5d05b86 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.08.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Patron can place a hold on the item.','Choice')"); + print "Upgrade to $DBversion done (Insert ReservesControlBranch systempreference into systempreferences table ))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.6.4.2 From root at li149-189.members.linode.com Thu May 3 10:11:20 2012 From: root at li149-189.members.linode.com (root) Date: Thu, 3 May 2012 04:11:20 -0400 Subject: [Koha-patches] [PATCH] Bug 7970 - Allow OPAC holds per library policy without default rule Message-ID: <1336032680-15790-1-git-send-email-root@li149-189.members.linode.com> From: Amit Gupta By default ReservesControlBranch systempreference is not inserting in systempreferences table. For this reason we have to set up default circulation rule for all libraries all itemtypes and all patron categories. After this we have to set only circulation rule by branch wise no need to set up for all libraries, itemtypes and patron categories. To Test: 1) Go to mysql use koha database 2) mysql> select * from systempreferences where variable = 'ReservesControlBranch'; +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ | variable | value | options | explanation | type | +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ | ReservesControlBranch | ItemHomeLibrary | ItemHomeLibrary|PatronLibrary | Patron can place a hold on the item. | Choice | +-----------------------+-----------------+-------------------------------+--------------------------------------+--------+ --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..2dcb1a2 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -362,3 +362,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Patron can place a hold on the item.','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 84f0437..5d05b86 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.08.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Patron can place a hold on the item.','Choice')"); + print "Upgrade to $DBversion done (Insert ReservesControlBranch systempreference into systempreferences table ))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.6.4.2 From amit.gupta at osslabs.biz Thu May 3 14:28:23 2012 From: amit.gupta at osslabs.biz (Amit Gupta) Date: Thu, 3 May 2012 17:58:23 +0530 Subject: [Koha-patches] [PATCH] Update the database as follow-up to Bug 5795 Message-ID: <1336048103-16807-1-git-send-email-amit.gupta@osslabs.biz> If value is not exist it insert other wise update the existing value. To Test: 1) Go to mysql use koha database 2) select * from systempreferences where variable = 'ReservesControlBranch'; 3) Show old result if value is present other wise it shows +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ | variable | value | options | explanation | type | +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ | ReservesControlBranch | ItemHomeLibrary | ItemHomeLibrary|PatronLibrary | Branch checked for members reservations rights. | Choice | +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ --- installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 84f0437..839613e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,18 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.08.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + if (C4::Context->preference('ReservesControlBranch')){ + my $sth = $dbh->prepare("UPDATE systempreferences SET value = ? WHERE variable = 'ReservesControlBranch'"); + $sth->execute(C4::Context->preference('ReservesControlBranch')); + }else{ + $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights.','Choice')"); + } + print "Upgrade to $DBversion done (Insert/Update ReservesControlBranch systempreference into systempreferences table )\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.6.4.2 From julian.maurice at biblibre.com Thu May 3 15:09:01 2012 From: julian.maurice at biblibre.com (julian.maurice at biblibre.com) Date: Thu, 3 May 2012 15:09:01 +0200 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 8019 - Preserve language choice between Browser sessions Message-ID: <1336050542-22143-1-git-send-email-julian.maurice@biblibre.com> From: Marc Veron Language choice in Opac an Staff client was not preserved between Browser sessions. Changed expiry date of cookie 'KohaOpacLanguage' from '' (= expire after session) to '+3y' (3 years from now) To test: - In a multilingual Koha istallation, choose a language. - Log out, close all Browser instances. Go to login screen. Login should show up in same language as before. - Repeat with other languages. modified: C4/Templates.pm Signed-off-by: Julian Maurice --- C4/Templates.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index d6e3ce4..47bda04 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -300,7 +300,7 @@ sub setlanguagecookie { my $cookie = $query->cookie( -name => 'KohaOpacLanguage', -value => $language, - -expires => '' + -expires => '+3y' ); print $query->redirect( -uri => $uri, -- 1.7.10 From adrien.saurat at biblibre.com Mon May 7 16:13:51 2012 From: adrien.saurat at biblibre.com (Adrien Saurat) Date: Mon, 7 May 2012 16:13:51 +0200 Subject: [Koha-patches] [PATCH] Bug 8045: fixes "date due" when checking in Message-ID: <1336400031-7525-1-git-send-email-adrien.saurat@biblibre.com> Added cloning of object parameters in "days_between" method. --- Koha/Calendar.pm | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index 75c5c9e..f63e7eb 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -169,13 +169,16 @@ sub days_between { my $start_dt = shift; my $end_dt = shift; + my $datestart_temp = $start_dt->clone(); + my $dateend_temp = $end_dt->clone(); + # start and end should not be closed days - my $duration = $end_dt->delta_days($start_dt); - $start_dt->truncate( to => 'days' ); - $end_dt->truncate( to => 'days' ); - while ( DateTime->compare( $start_dt, $end_dt ) == -1 ) { - $start_dt->add( days => 1 ); - if ( $self->is_holiday($start_dt) ) { + my $duration = $dateend_temp->delta_days($datestart_temp); + $datestart_temp->truncate( to => 'days' ); + $dateend_temp->truncate( to => 'days' ); + while ( DateTime->compare( $datestart_temp, $dateend_temp ) == -1 ) { + $datestart_temp->add( days => 1 ); + if ( $self->is_holiday($datestart_temp) ) { $duration->subtract( days => 1 ); } } -- 1.7.4.1 From amit.gupta at osslabs.biz Tue May 8 13:32:30 2012 From: amit.gupta at osslabs.biz (Amit Gupta) Date: Tue, 8 May 2012 17:02:30 +0530 Subject: [Koha-patches] [PATCH] Update the database as follow-up to Bug 5795 Message-ID: <1336476750-13724-1-git-send-email-amit.gupta@osslabs.biz> If sys pref ReservesControlBranch has null then update the table to insert a ItemHomeLibrary as value To Test: 1) Go to mysql use koha database 2) select * from systempreferences where variable = 'ReservesControlBranch'; Check if value set to ItemHomeLibrary. +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ | variable | value | options | explanation | type | +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ | ReservesControlBranch | ItemHomeLibrary | ItemHomeLibrary|PatronLibrary | Branch checked for members reservations rights. | Choice | +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ --- installer/data/mysql/updatedatabase.pl | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 2f66e79..4edbc5a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5219,6 +5219,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + unless(C4::Context->preference('ReservesControlBranch')){ + $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','ItemHomeLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights.','Choice')"); + } + print "Upgrade to $DBversion done (Insert ReservesControlBranch systempreference into systempreferences table )\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 TableExists($table) -- 1.6.4.2 From srdjan at catalyst.net.nz Wed May 9 04:50:34 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Wed, 9 May 2012 14:50:34 +1200 Subject: [Koha-patches] [PATCH] bug_8056: sorted out slip print calls In-Reply-To: References: Message-ID: <1336531834-15731-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Members.pm | 1 - C4/Print.pm | 16 +++++++--------- circ/circulation.pl | 8 ++++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 6161ac9..693e0ba 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -997,7 +997,6 @@ sub GetPendingIssues { # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance # FIXME: namespace collision: each table has "timestamp" fields. Which one is "timestamp" ? # FIXME: circ/ciculation.pl tries to sort by timestamp! - # FIXME: C4::Print::printslip tries to sort by timestamp! # FIXME: namespace collision: other collisions possible. # FIXME: most of this data isn't really being used by callers. my $query = diff --git a/C4/Print.pm b/C4/Print.pm index c0b37c8..d28b00c 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -28,7 +28,7 @@ BEGIN { $VERSION = 3.01; require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(&printslip); + @EXPORT = qw(&NetworkPrint); } =head1 NAME @@ -72,18 +72,16 @@ $bordata->{'emailaddress'} EOF =cut -=head2 printslip +=head2 NetworkPrint - &printslip($slip) + &NetworkPrint($text) -print a slip for the given $borrowernumber and $branchcode +Queue some text for printing on the selected branch printer =cut -sub printslip ($) { - my ($slip) = @_; - - return unless ( C4::Context->boolean_preference('printcirculationslips') ); +sub NetworkPrint ($) { + my ($text) = @_; # FIXME - It'd be nifty if this could generate pretty PostScript. @@ -112,7 +110,7 @@ sub printslip ($) { # print $queue; #open (FILE,">/tmp/$file"); - print PRINTER $slip; + print PRINTER $text; print PRINTER "\r\n" x 7 ; close PRINTER; diff --git a/circ/circulation.pl b/circ/circulation.pl index bcbcb6f..c28fdc8 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -25,6 +25,7 @@ use strict; use warnings; use CGI; use C4::Output; +use C4::Print; use C4::Auth qw/:DEFAULT get_session/; use C4::Dates qw/format_date/; use C4::Branch; # GetBranches @@ -156,7 +157,7 @@ if($duedatespec_allow){ } } -our $todaysdate = C4::Dates->new->output('iso'); +my $todaysdate = C4::Dates->new->output('iso'); # check and see if we should print if ( $barcode eq '' && $print eq 'maybe' ) { @@ -172,7 +173,10 @@ if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { } if ( $print eq 'yes' && $borrowernumber ne '' ) { - PrintIssueSlip($session->param('branch') || $branch, $borrowernumber); + if ( C4::Context->boolean_preference('printcirculationslips') ) { + my $letter = IssueSlip($branch, $borrowernumber, "QUICK"); + NetworkPrint($letter->{content}); + } $query->param( 'borrowernumber', '' ); $borrowernumber = ''; } -- 1.7.9.5 From srdjan at catalyst.net.nz Wed May 9 05:21:55 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Wed, 9 May 2012 15:21:55 +1200 Subject: [Koha-patches] [PATCH] bug_7420: Added overduefinescap to issuingrules In-Reply-To: References: Message-ID: <1336533715-16811-1-git-send-email-srdjan@catalyst.net.nz> Replaced existing MaxFine syspref logic with overduefinescap. Repurposed MaxFine to be the overall overdue limit for all items overdue. Implemented new MaxFine logic in UpdateFine(). --- C4/Overdues.pm | 48 +++++++++++++++----- admin/smart-rules.pl | 9 ++-- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 15 ++++++ .../prog/en/modules/admin/preferences/patrons.pref | 3 +- .../prog/en/modules/admin/smart-rules.tt | 3 ++ 7 files changed, 63 insertions(+), 18 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index c7430c9..326b2a7 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -241,8 +241,8 @@ C<$amount> is the fine owed by the patron (see above). C<$chargename> is the chargename field from the applicable record in the categoryitem table, whatever that is. -C<$daycount> is the number of days between start and end dates, Calendar adjusted (where needed), -minus any applicable grace period. +C<$unitcount> is the number of chargeable units (days between start and end dates, Calendar adjusted where needed, +minus any applicable grace period, or hours) FIXME - What is chargename supposed to be ? @@ -268,10 +268,9 @@ sub CalcFine { } else { # a zero (or null) chargeperiod means no charge. } - if(C4::Context->preference('maxFine') && ( $amount > C4::Context->preference('maxFine'))) { - $amount = C4::Context->preference('maxFine'); - } - return ($amount, $data->{chargename}, $units_minus_grace); + $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap}; + $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $days_minus_grace, $chargeable_units); + return ($amount, $data->{'chargename'}, $days_minus_grace, $chargeable_units); # FIXME: chargename is NEVER populated anywhere. } @@ -521,14 +520,39 @@ sub UpdateFine { # "REF" is Cash Refund my $sth = $dbh->prepare( "SELECT * FROM accountlines - WHERE itemnumber=? - AND borrowernumber=? - AND accounttype IN ('FU','O','F','M') - AND description like ? " + WHERE borrowernumber=? + AND accounttype IN ('FU','O','F','M')" ); - $sth->execute( $itemnum, $borrowernumber, "%$due%" ); + $sth->execute( $borrowernumber ); + my $data; + my $total_amount_other = 0.00; + my $due_qr = qr/$due/; + # Cycle through the fines and + # - find line that relates to the requested $itemnum + # - accumulate fines for other items + # so we can update $itemnum fine taking in account fine caps + while (my $rec = $sth->fetchrow_hashref) { + if ($rec->{itemnumber} == $itemnum && $rec->{description} =~ /$due_qr/) { + if ($data) { + warn "Not a unique accountlines record for item $itemnum borrower $borrowernumber"; + } else { + $data = $rec; + next; + } + } + $total_amount_other += $rec->{'amount'}; + } + if (my $maxfine = C4::Context->preference('MaxFine')) { + if ($total_amount_other + $amount > $maxfine) { + my $new_amount = $maxfine - $total_amount_other; + warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached"; + return if $new_amount <= 0.00; + + $amount = $new_amount; + } + } - if ( my $data = $sth->fetchrow_hashref ) { + if ( $data ) { # we're updating an existing fine. Only modify if amount changed # Note that in the current implementation, you cannot pay against an accruing fine diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 8e5a2d5..03463b9 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -101,8 +101,8 @@ elsif ($op eq 'delete-branch-item') { # save the values entered elsif ($op eq 'add') { my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?'); - my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); - my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); + my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); + my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); my $br = $branch; # branch my $bor = $input->param('categorycode'); # borrower category @@ -122,14 +122,15 @@ elsif ($op eq 'add') { $hardduedate = format_date_in_iso($hardduedate); my $hardduedatecompare = $input->param('hardduedatecompare'); my $rentaldiscount = $input->param('rentaldiscount'); + my $overduefinescap = $input->param('overduefinescap') || undef; $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty"; $sth_search->execute($br,$bor,$cat); my $res = $sth_search->fetchrow_hashref(); if ($res->{total}) { - $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat); + $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); } else { - $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount); + $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); } } elsif ($op eq "set-branch-defaults") { diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 488a4f0..51fb414 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -996,6 +996,7 @@ CREATE TABLE `issuingrules` ( `renewalsallowed` smallint(6) NOT NULL default "0", `reservesallowed` smallint(6) NOT NULL default "0", `branchcode` varchar(10) NOT NULL default '', + overduefinescap decimal default NULL, PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`), KEY `categorycode` (`categorycode`), KEY `itemtype` (`itemtype`) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..58e5170 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -62,7 +62,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES -- this is selected by the web installer now -- INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('marcflavour','MARC21','Define global MARC flavor (MARC21 or UNIMARC) used for character encoding','MARC21|UNIMARC','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MARCOrgCode','OSt','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','','free'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',9999,'Maximum fine a patron can have for a single late return','','Integer'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',NULL,'Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxoutstanding',5,'maximum amount withstanding to be able make holds','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxreserves',50,'Define maximum number of holds a patron can place','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxItemsInSearchResults',20,'Specify the maximum number of items to display for each result on a page of results',NULL,'free'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 2f66e79..3b08682 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5219,6 +5219,21 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } + + +$DBversion = '3.07.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE issuingrules ADD overduefinescap decimal DEFAULT NULL"); + my $maxfine = C4::Context->preference('MaxFine'); + if ($maxfine && $maxfine < 900) { # an arbitrary value that tells us it's not "some huge value" + $dbh->do("UPDATE issuingrules SET overduefinescap=?",undef,$maxfine); + $dbh->do("UPDATE systempreferences SET value = NULL WHERE variable = 'MaxFine'"); + } + $dbh->do("UPDATE systempreferences SET explanation = 'Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.' WHERE variable = 'MaxFine'"); + print "Upgrade to $DBversion done (Bug 7420 add overduefinescap to circulation matrix)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 55b4457..5600874 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -74,10 +74,11 @@ Patrons: no: "Don't allow" - "staff to access a patron's checkout history (it is stored regardless)." - - - The late fine for a specific checkout will only go up to + - The late fine for all checkouts will only go up to - pref: MaxFine class: currency - '[% local_currency %].' + - Empty value means no limit. Single item caps are specified in the circulation rules matrix. - - pref: memberofinstitution choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index 635051f..dd77946 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -78,6 +78,7 @@ for="tobranch">Clone these rules to: Clone these rules to: [% rule.finedays %] [% rule.renewalsallowed %] [% rule.reservesallowed %] @@ -182,6 +184,7 @@ for="tobranch">Clone these rules to: + -- 1.7.9.5 From oleonard at myacpl.org Wed May 9 18:33:35 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Wed, 9 May 2012 12:33:35 -0400 Subject: [Koha-patches] [PATCH] Bug 8048 - better spacing on categories for attributes Message-ID: <1336581215-18921-1-git-send-email-oleonard@myacpl.org> - Convert

    to and adding comfortable padding. - Add quotes to attribute for validity - Add padding to patron messaging note too since it has the same problem. To test you must have at least one value added to the PA_CLASS authorised value category. At least one patron attribute must be categorized using that value. On the patron edit screen that patron attribute category should display with comfortable padding. --- .../intranet-tmpl/prog/en/css/staff-global.css | 8 ++++++++ .../prog/en/modules/members/memberentrygen.tt | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) 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 68523d7..338b768 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -692,6 +692,14 @@ fieldset.rows ol.radio label.radio { margin-right : 1em; } +fieldset.rows caption { + font-size : 120%; +} + +fieldset.rows p { + margin : 1em 0 1em 1em; +} + fieldset.rows table { font-size : 105%; clear : both; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index bc1f07c..0cb2877 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1384,8 +1384,8 @@ Additional attributes and identifiers [% FOREACH pa_loo IN patron_attributes %] [% IF pa_loo.class %] -

    [% pa_loo.lib %]

    - +
    + [% ELSE %]
    [% pa_loo.lib %]
    [% END %] @@ -1497,7 +1497,7 @@ Patron messaging preferences [% IF type_only %] - If no preferences are selected, the default preferences for the category chosen will be applied on save, otherwise your selection here is saved +

    If no preferences are selected, the default preferences for the category chosen will be applied on save, otherwise your selection here is saved

    [% END %] [% INCLUDE 'messaging-preference-form.inc' %] [% IF ( SMSSendDriver ) %] -- 1.7.9.5 From oleonard at myacpl.org Wed May 9 20:30:45 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Wed, 9 May 2012 14:30:45 -0400 Subject: [Koha-patches] [PATCH] Bug 7877 - note on expiration in the opac worded wrongish Message-ID: <1336588245-19312-1-git-send-email-oleonard@myacpl.org> Correction following Nicole's suggestion. --- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt index 9729c7c..b635aec 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -83,7 +83,7 @@ $.tablesorter.addParser({ [% IF ( BORROWER_INF.warndeparture ) %]
    - Please note: Your card will expire on [% BORROWER_INF.warndeparture %]. Please contact the library if you wish to renew your subscription. + Please note: Your card will expire on [% BORROWER_INF.warndeparture %]. Please contact the library for more information. [% IF ( BORROWER_INF.returnbeforeexpiry ) %] Also note that you must return all checked out items before your card expires.[% END %]
    [% END %] -- 1.7.9.5 From oleonard at myacpl.org Wed May 9 21:43:16 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Wed, 9 May 2012 15:43:16 -0400 Subject: [Koha-patches] [PATCH] Bug 7842 - Inconsistencies in Notices interface Message-ID: <1336592596-20022-1-git-send-email-oleonard@myacpl.org> - Putting "New" button in toolbar
    - Moving "Copy" function and making label more explicit - Adding page headings - Correcting table header sort options --- .../intranet-tmpl/prog/en/modules/tools/letter.tt | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index dd32550..374b2f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -8,7 +8,7 @@ $(document).ready(function() { $("#lettert:has(tbody tr)").tablesorter({ widgets : ['zebra'], sortList: [[0,0]], - headers: { 3: {sorter:false},4: { sorter: false }} + headers: { 4: {sorter:false},5: { sorter: false },6: { sorter: false }} }); $('#branch').change(function() { @@ -130,6 +130,7 @@ $(document).ready(function() {
    [% IF ( no_op_set ) %] +

    Notices and Slips

    [% UNLESS independant_branch %] @@ -143,10 +144,10 @@ $(document).ready(function() {

    [% END %] -

    +

    -

    +
    [% IF ( search ) %] @@ -156,7 +157,7 @@ $(document).ready(function() { [% select_for_copy = BLOCK %] [% END %] @@ -167,7 +168,7 @@ $(document).ready(function() {
    - + @@ -184,11 +185,6 @@ $(document).ready(function() { - + - [% END %][% ELSE %][% END %] + [% END %][% ELSE %][% END %]
    Module Code Name Copy notice    
    [% lette.code %] [% lette.name %] - [% IF can_edit %] - Edit - [% END %] - [% IF !independant_branch || !lette.branchcode %]
    @@ -203,6 +199,11 @@ $(document).ready(function() {
    [% END %] +
    + [% IF can_edit %] + Edit + [% END %] [% IF !lette.protected && can_edit %] @@ -217,7 +218,7 @@ $(document).ready(function() { [% IF ( add_form ) %] - +

    [% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]

    @@ -227,7 +228,6 @@ $(document).ready(function() { [% END %]
    - [% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %] [% IF independant_branch %] -- 1.7.9.5 From srdjan at catalyst.net.nz Fri May 11 04:20:30 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Fri, 11 May 2012 14:20:30 +1200 Subject: [Koha-patches] [PATCH] bug_8056: sorted out slip print calls In-Reply-To: References: Message-ID: <1336702830-5010-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Members.pm | 1 - C4/Print.pm | 16 +++++++--------- circ/circulation.pl | 6 +++++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 6161ac9..693e0ba 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -997,7 +997,6 @@ sub GetPendingIssues { # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance # FIXME: namespace collision: each table has "timestamp" fields. Which one is "timestamp" ? # FIXME: circ/ciculation.pl tries to sort by timestamp! - # FIXME: C4::Print::printslip tries to sort by timestamp! # FIXME: namespace collision: other collisions possible. # FIXME: most of this data isn't really being used by callers. my $query = diff --git a/C4/Print.pm b/C4/Print.pm index c0b37c8..d28b00c 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -28,7 +28,7 @@ BEGIN { $VERSION = 3.01; require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(&printslip); + @EXPORT = qw(&NetworkPrint); } =head1 NAME @@ -72,18 +72,16 @@ $bordata->{'emailaddress'} EOF =cut -=head2 printslip +=head2 NetworkPrint - &printslip($slip) + &NetworkPrint($text) -print a slip for the given $borrowernumber and $branchcode +Queue some text for printing on the selected branch printer =cut -sub printslip ($) { - my ($slip) = @_; - - return unless ( C4::Context->boolean_preference('printcirculationslips') ); +sub NetworkPrint ($) { + my ($text) = @_; # FIXME - It'd be nifty if this could generate pretty PostScript. @@ -112,7 +110,7 @@ sub printslip ($) { # print $queue; #open (FILE,">/tmp/$file"); - print PRINTER $slip; + print PRINTER $text; print PRINTER "\r\n" x 7 ; close PRINTER; diff --git a/circ/circulation.pl b/circ/circulation.pl index bcbcb6f..c89abff 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -25,6 +25,7 @@ use strict; use warnings; use CGI; use C4::Output; +use C4::Print; use C4::Auth qw/:DEFAULT get_session/; use C4::Dates qw/format_date/; use C4::Branch; # GetBranches @@ -172,7 +173,10 @@ if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { } if ( $print eq 'yes' && $borrowernumber ne '' ) { - PrintIssueSlip($session->param('branch') || $branch, $borrowernumber); + if ( C4::Context->boolean_preference('printcirculationslips') ) { + my $letter = IssueSlip($branch, $borrowernumber, "QUICK"); + NetworkPrint($letter->{content}); + } $query->param( 'borrowernumber', '' ); $borrowernumber = ''; } -- 1.7.9.5 From oleonard at myacpl.org Fri May 11 21:30:31 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 11 May 2012 15:30:31 -0400 Subject: [Koha-patches] [PATCH] Bug 8078 - my summary showing contents of incorrect tab Message-ID: <1336764631-3958-1-git-send-email-oleonard@myacpl.org> This patch moves the holdings tab content to the correct position sequentially with regard to the order of the tabs themselves. My guess is that the jQuery upgrade has something to do with this change but I'm not sure why (probably something in our aging tabs plugin which works differently with the new jQuery version). Making the sequence of the tab contents match the sequence of the tabs seems to fix the problem. --- .../prog/en/modules/members/moremember.tt | 64 ++++---- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 165 ++++++++++---------- 2 files changed, 114 insertions(+), 115 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 326de06..d2717ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -288,7 +288,7 @@ function validate1(date) { [% FOREACH attribute IN attributes_loop %] [% IF attribute.class %]

    [% attribute.lib %]

    - +
    [% ELSE %]
    [% END %] @@ -407,36 +407,14 @@ function validate1(date) { -
    - - -
    - [% IF ( totaldue_raw ) %] -

    Total due: [% totaldue %]

    - [% ELSE %] -

    No outstanding charges

    - [% END %] -
    - - +
    [% IF ( issueloop ) %]
    - + @@ -458,7 +436,7 @@ function validate1(date) { [% END %] [% IF ( issueloo.red ) %] - - + [% IF ( issueloo.renew_failed ) %] @@ -495,9 +473,9 @@ function validate1(date) { [% IF ( issueloo.norenew_reason_on_reserve ) %] On Hold [% END %] - [% IF ( issueloo.norenew_reason_too_many ) %] + [% IF ( issueloo.norenew_reason_too_many ) %] Not renewable - [% END %] + [% END %] [% IF ( issueloo.can_confirm ) %] [% END %] @@ -545,7 +523,7 @@ function validate1(date) {
    Due date Title Item type
    + [% ELSE %] [% END %] @@ -474,7 +452,7 @@ function validate1(date) { [% UNLESS ( noItemTypeImages ) %] [% IF ( issueloo.itemtype_image ) %][% END %][% END %][% issueloo.itemtype_description %] [% issueloo.issuedate %] [% issueloo.issuingbranchname %][% issueloo.itemcallnumber %][% issueloo.itemcallnumber %] [% issueloo.charge %] [% issueloo.replacementprice %]
    - + @@ -585,15 +563,37 @@ function validate1(date) { - + [% END %]
    Due date Title Item type[% relissueloo.itemcallnumber %] [% relissueloo.charge %] [% relissueloo.replacementprice %][% relissueloo.firstname %] [% relissueloo.surname %] ([% relissueloo.cardnumber %])[% relissueloo.firstname %] [% relissueloo.surname %] ([% relissueloo.cardnumber %])
    - + [% END %] + +
    + +
    + [% IF ( totaldue_raw ) %] +

    Total due: [% totaldue %]

    + [% ELSE %] +

    No outstanding charges

    + [% END %] +
    +
    [% IF ( reservloop ) %]
    diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt index b635aec..2b88c7a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -120,77 +120,15 @@ $.tablesorter.addParser({ [% IF ( waiting_count ) %][% IF ( BORROWER_INF.atdestination ) %]
  • Waiting
  • [% END %][% END %] [% IF ( reserves_count ) %]
  • Holds
  • [% END %] - -[% IF ( OPACFinesTab ) %] - - [% IF ( BORROWER_INF.amountoverfive ) %] -

    Fines and charges

    - - - - - - -
    Amount
    You currently owe fines and charges amounting to:[% BORROWER_INF.amountoutstanding %]
    - [% END %] - - [% IF ( BORROWER_INF.amountoverzero ) %] -

    Fines and charges

    - - - - -
    Amount
    You currently owe fines and charges amounting to:[% BORROWER_INF.amountoutstanding %]
    - [% END %] - - [% IF ( BORROWER_INF.amountlessthanzero ) %] -

    Credits

    - - - -
    Amount
    You have a credit of:[% BORROWER_INF.amountoutstanding %]
    - [% END %] -[% END %] - - [% END %] - - [% IF ( waiting_count ) %] - [% IF ( atdestination ) %] -
    - - - - - - - - [% FOREACH WAITIN IN WAITING %] - - - - - - - [% END %] -
    Holds waiting
    TitleHold datePick up library
    [% WAITIN.itemtype %] - [% WAITIN.waiting_title %] - - [% WAITIN.author %] - [% WAITIN.reservedate | $KohaDates %][% IF ( WAITIN.atdestination ) %]Waiting at [% WAITIN.branch %] - [% ELSE %] - In transit from [% WAITIN.holdingbranch %] to [% WAITIN.branch %] - [% END %]
    - [% END %] - [% END %]
    [% IF ( issues_count ) %] - - + + - [% IF ( JacketImages ) %][% END %] + [% IF ( JacketImages ) %][% END %] [% UNLESS ( item_level_itypes ) %] [% END %] @@ -207,15 +145,15 @@ $.tablesorter.addParser({ [% END %] - - [% FOREACH ISSUE IN ISSUES %] + --> + [% FOREACH ISSUE IN ISSUES %] [% IF ( ISSUE.overdue ) %][% ELSE %][% END %] [% IF ( JacketImages ) %] [% END %]
    [% issues_count %] Item(s) checked out
      Title DueItem type
    @@ -259,27 +197,88 @@ $.tablesorter.addParser({
    - [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %] - - [% END %] - + [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %] + + [% END %] + [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %] -
    - - - [% FOREACH ISSUE IN ISSUES %] - - [% END %] - -
    - [% END %] +
    + + + [% FOREACH ISSUE IN ISSUES %] + + [% END %] + +
    + [% END %] [% ELSE %]
    You have nothing checked out
    [% END %]
    + +[% IF ( OPACFinesTab ) %] + + [% IF ( BORROWER_INF.amountoverfive ) %] +

    Fines and charges

    + + + + + + +
    Amount
    You currently owe fines and charges amounting to:[% BORROWER_INF.amountoutstanding %]
    + [% END %] + + [% IF ( BORROWER_INF.amountoverzero ) %] +

    Fines and charges

    + + + + +
    Amount
    You currently owe fines and charges amounting to:[% BORROWER_INF.amountoutstanding %]
    + [% END %] + + [% IF ( BORROWER_INF.amountlessthanzero ) %] +

    Credits

    + + + +
    Amount
    You have a credit of:[% BORROWER_INF.amountoutstanding %]
    + [% END %] +[% END %] - + [% END %] + + [% IF ( waiting_count ) %] + [% IF ( atdestination ) %] +
    + + + + + + + + [% FOREACH WAITIN IN WAITING %] + + + + + + + [% END %] +
    Holds waiting
    TitleHold datePick up library
    [% WAITIN.itemtype %] + [% WAITIN.waiting_title %] + + [% WAITIN.author %] + [% WAITIN.reservedate | $KohaDates %][% IF ( WAITIN.atdestination ) %]Waiting at [% WAITIN.branch %] + [% ELSE %] + In transit from [% WAITIN.holdingbranch %] to [% WAITIN.branch %] + [% END %]
    + [% END %] + [% END %] + [% IF ( overdues_count ) %]
    -- 1.7.9.5 From srdjan at catalyst.net.nz Mon May 14 03:02:30 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Mon, 14 May 2012 13:02:30 +1200 Subject: [Koha-patches] [PATCH] bug_8034: Restored network printer maintenance and selection In-Reply-To: References: Message-ID: <1336957350-946-1-git-send-email-srdjan@catalyst.net.nz> This patch is just for restoring printer maintenance and selection, not for priting itself. It is just a preparation step. * Added UsePrintQueues syspref. If set to No, no printer info will be displayed/used * Database changes: - printers table PRIMARY KEY is now printqueue. It is more natural. We should really have a synthetic id, but printqueue is good enough - branches.branchprinter is a FOREIGN KEY to printers.printqueue * Created C4::Auth::get_user_printer() function that will return appropriate printer. In order of preference: - session selected - logged in branch branchprinter * Created C4::Koha::GetPrinterDetails($printqueue) * Restored printer maint/selection in admin zone UsePrintQueues permitting * Restored printer selection in circ/selectbranchprinter.pl UsePrintQueues permitting --- C4/Auth.pm | 49 ++++++++++++++++---- C4/Context.pm | 2 +- C4/Koha.pm | 15 +++++- C4/Members.pm | 1 - admin/branches.pl | 29 +++++++----- admin/printers.pl | 13 +++--- circ/circulation.pl | 10 ---- circ/returns.pl | 8 ---- circ/selectbranchprinter.pl | 48 ++++++++++--------- installer/data/mysql/kohastructure.sql | 18 +++---- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 13 ++++++ .../intranet-tmpl/prog/en/includes/header.inc | 3 ++ .../prog/en/modules/admin/admin-home.tt | 4 +- .../prog/en/modules/admin/branches.tt | 20 ++++---- .../en/modules/admin/preferences/circulation.pref | 6 +++ .../prog/en/modules/admin/printers.tt | 13 ++---- .../prog/en/modules/circ/circulation.tt | 2 - .../prog/en/modules/circ/selectbranchprinter.tt | 5 +- 19 files changed, 159 insertions(+), 101 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index ffee1bb..9ab1942 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -26,6 +26,7 @@ use CGI::Session; require Exporter; use C4::Context; +use C4::Koha; use C4::Templates; # to get the template use C4::Branch; # GetBranches use C4::VirtualShelves; @@ -45,7 +46,8 @@ BEGIN { $debug = $ENV{DEBUG}; @ISA = qw(Exporter); @EXPORT = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions); - @EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &get_all_subpermissions &get_user_subpermissions); + @EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw + &get_all_subpermissions &get_user_subpermissions &get_user_printer); %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); $ldap = C4::Context->config('useldapserver') || 0; $cas = C4::Context->preference('casAuthentication'); @@ -309,6 +311,9 @@ sub get_template_and_user { $template->param(dateformat_iso => 1); } + my $userenv = C4::Context->userenv; + my $userenv_branch = $userenv ? $userenv->{"branch"} : undef; + # these template parameters are set the same regardless of $in->{'type'} $template->param( "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, @@ -316,9 +321,9 @@ sub get_template_and_user { GoogleJackets => C4::Context->preference("GoogleJackets"), OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"), KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"), - LoginBranchcode => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"), - LoginFirstname => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"), - LoginSurname => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu", + LoginBranchcode => ($userenv?$userenv_branch:"insecure"), + LoginFirstname => ($userenv?$userenv->{"firstname"}:"Bel"), + LoginSurname => $userenv?$userenv->{"surname"}:"Inconnu", TagsEnabled => C4::Context->preference("TagsEnabled"), hide_marc => C4::Context->preference("hide_marc"), item_level_itypes => C4::Context->preference('item-level_itypes'), @@ -345,7 +350,7 @@ sub get_template_and_user { IntranetNav => C4::Context->preference("IntranetNav"), IntranetmainUserblock => C4::Context->preference("IntranetmainUserblock"), LibraryName => C4::Context->preference("LibraryName"), - LoginBranchname => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"), + LoginBranchname => ($userenv?$userenv->{"branchname"}:"insecure"), advancedMARCEditor => C4::Context->preference("advancedMARCEditor"), canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'), intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), @@ -364,6 +369,14 @@ sub get_template_and_user { OPACLocalCoverImages => C4::Context->preference('OPACLocalCoverImages'), AllowMultipleCovers => C4::Context->preference('AllowMultipleCovers'), ); + if ( C4::Context->preference('UsePrintQueues') ) { + my $printer = get_user_printer(); + my $printer_rec = $printer ? GetPrinterDetails($printer) : {}; + $template->param( + UsePrintQueues => 1, + PrinterName => $printer_rec->{printername}, + ); + } } else { warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' ); @@ -382,8 +395,8 @@ sub get_template_and_user { my $opac_name = ''; if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $in->{'query'}->param('limit') =~ /branch:(\w+)/){ $opac_name = $1; # opac_search_limit is a branch, so we use it. - } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) { - $opac_name = C4::Context->userenv->{'branch'}; + } elsif (C4::Context->preference("SearchMyLibraryFirst") && $userenv_branch) { + $opac_name = $userenv_branch } my $checkstyle = C4::Context->preference("opaccolorstylesheet"); if ($checkstyle =~ /http/) @@ -402,7 +415,7 @@ sub get_template_and_user { CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1, LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, - LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"", + LoginBranchname => $userenv?$userenv->{"branchname"}:"", OPACAmazonEnabled => C4::Context->preference("OPACAmazonEnabled"), OPACAmazonSimilarItems => C4::Context->preference("OPACAmazonSimilarItems"), OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"), @@ -435,7 +448,7 @@ sub get_template_and_user { RequestOnOpac => C4::Context->preference("RequestOnOpac"), 'Version' => C4::Context->preference('Version'), hidelostitems => C4::Context->preference("hidelostitems"), - mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '', + mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst") && $userenv) ? $userenv_branch : '', opaclayoutstylesheet => "" . C4::Context->preference("opaclayoutstylesheet"), opacstylesheet => "" . C4::Context->preference("opacstylesheet"), opacbookbag => "" . C4::Context->preference("opacbookbag"), @@ -1664,8 +1677,24 @@ sub getborrowernumber { return 0; } +=head2 get_user_printer + + $printer = get_user_printer(); + + Returns printer queue that is to be used for the logged in user + +=cut + +sub get_user_printer { + my $userenv = C4::Context->userenv or return; + if (my $printer = $userenv->{branchprinter}) { + return $printer; + } + my $branchname = $userenv->{branch} or return; + my $branch = GetBranchDetail($branchname) or return; + return $branch->{branchprinter}; +} -END { } # module clean-up code here (global destructor) 1; __END__ diff --git a/C4/Context.pm b/C4/Context.pm index 67d31ee..32c15aa 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -998,7 +998,7 @@ sub userenv { =head2 set_userenv C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, - $usersurname, $userbranch, $userflags, $emailaddress); + $usersurname, $userbranch, $userflags, $emailaddress, $branchprinter); Establish a hash of user environment variables. diff --git a/C4/Koha.pm b/C4/Koha.pm index a028937..7f911c3 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -34,7 +34,7 @@ BEGIN { @EXPORT = qw( &slashifyDate &subfield_is_koha_internal_p - &GetPrinters &GetPrinter + &GetPrinters &GetPrinter &GetPrinterDetails &GetItemTypes &getitemtypeinfo &GetCcodes &GetSupportName &GetSupportList @@ -633,6 +633,19 @@ sub GetPrinter ($$) { return $printer; } +=head2 GetPrinterDetails + + $printer_rec = GetPrinterDetails( $printqueue ); + +=cut + +sub GetPrinterDetails { + my ( $printer ) = @_; + my $dbh = C4::Context->dbh; + my $printername = $dbh->selectrow_hashref('SELECT * FROM printers WHERE printqueue = ?', undef, $printer); + return $printername; +} + =head2 getnbpages Returns the number of pages to display in a pagination bar, given the number diff --git a/C4/Members.pm b/C4/Members.pm index 6161ac9..693e0ba 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -997,7 +997,6 @@ sub GetPendingIssues { # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance # FIXME: namespace collision: each table has "timestamp" fields. Which one is "timestamp" ? # FIXME: circ/ciculation.pl tries to sort by timestamp! - # FIXME: C4::Print::printslip tries to sort by timestamp! # FIXME: namespace collision: other collisions possible. # FIXME: most of this data isn't really being used by callers. my $query = diff --git a/admin/branches.pl b/admin/branches.pl index c12762d..2b4c982 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -226,12 +226,9 @@ sub default { sub editbranchform { my ($branchcode,$innertemplate) = @_; - # initiate the scrolling-list to select the printers - my $printers = GetPrinters(); - my @printerloop; + my $data; my $oldprinter = ""; - if ($branchcode) { $data = GetBranchInfo($branchcode); $data = $data->[0]; @@ -241,15 +238,21 @@ sub editbranchform { _branch_to_template($data, $innertemplate); } - foreach my $thisprinter ( keys %$printers ) { - push @printerloop, { - value => $thisprinter, - selected => ( $oldprinter eq $printers->{$thisprinter} ), - branchprinter => $printers->{$thisprinter}->{'printqueue'}, - }; + if ( C4::Context->preference('UsePrintQueues') ) { + # initiate the scrolling-list to select the printers + my $printers = GetPrinters(); + my @printerloop; + foreach my $thisprinter ( keys %$printers ) { + push @printerloop, { + value => $thisprinter, + selected => ( $oldprinter eq $printers->{$thisprinter} ), + branchprinter => $printers->{$thisprinter}->{'printername'}, + }; + } + + $innertemplate->param( printerloop => \@printerloop ); } - $innertemplate->param( printerloop => \@printerloop ); # make the checkboxes..... # # We export a "categoryloop" array to the template, each element of which @@ -308,6 +311,7 @@ sub branchinfotable { my ($branchcode,$innertemplate) = @_; my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo(); + my $printers = GetPrinters(); my @loop_data = (); foreach my $branch (@$branchinfo) { # @@ -367,6 +371,9 @@ sub branchinfotable { $row{'branch_name'} = $branch->{'branchname'}; $row{'branch_code'} = $branch->{'branchcode'}; $row{'value'} = $branch->{'branchcode'}; + if (my $printer = $branch->{'branchprinter'}) { + $row{'branchprintername'} = $printers->{$printer}->{'printername'}; + } push @loop_data, \%row; } diff --git a/admin/printers.pl b/admin/printers.pl index c32b4e6..a81e3ab 100755 --- a/admin/printers.pl +++ b/admin/printers.pl @@ -89,12 +89,13 @@ if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $data; if ($searchfield) { - my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printername=?"); + my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printqueue=?"); $sth->execute($searchfield); $data=$sth->fetchrow_hashref; } $template->param(printqueue => $data->{'printqueue'}, + printername => $data->{'printername'}, printtype => $data->{'printtype'}); # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## @@ -105,15 +106,15 @@ if ($op eq 'add_form') { my $sth=$dbh->prepare("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)"); $sth->execute($input->param('printername'),$input->param('printqueue'),$input->param('printtype')); } else { - my $sth=$dbh->prepare("UPDATE printers SET printqueue=?,printtype=? WHERE printername=?"); - $sth->execute($input->param('printqueue'),$input->param('printtype'),$input->param('printername')); + my $sth=$dbh->prepare("UPDATE printers SET printername=?,printqueue=?,printtype=? WHERE printqueue=?"); + $sth->execute($input->param('printername'),$input->param('printqueue'),$input->param('printtype'),$searchfield); } # END $OP eq ADD_VALIDATE ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ($op eq 'delete_confirm') { $template->param(delete_confirm => 1); - my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printername=?"); + my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printqueue=?"); $sth->execute($searchfield); my $data=$sth->fetchrow_hashref; $template->param(printqueue => $data->{'printqueue'}, @@ -123,7 +124,7 @@ if ($op eq 'add_form') { # called by delete_confirm, used to effectively confirm deletion of data in DB } elsif ($op eq 'delete_confirmed') { $template->param(delete_confirmed => 1); - my $sth=$dbh->prepare("delete from printers where printername=?"); + my $sth=$dbh->prepare("delete from printers where printqueue=?"); $sth->execute($searchfield); # END $OP eq DELETE_CONFIRMED ################## DEFAULT ########################################### @@ -131,7 +132,7 @@ if ($op eq 'add_form') { $template->param(else => 1); my ($count,$results)=StringSearch($searchfield,'web'); my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count; - my @loop = (@$results)[$offset..$max]; + my @loop = (@$results)[$offset..$max-1]; $template->param(loop => \@loop); diff --git a/circ/circulation.pl b/circ/circulation.pl index bcbcb6f..4815879 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -66,12 +66,6 @@ if ($branch){ $session->param('branchname', GetBranchName($branch)); } -my $printer = $query->param('printer'); -if ($printer){ - # update our session so the userenv is updated - $session->param('branchprinter', $printer); -} - if (!C4::Context->userenv && !$branch){ if ($session->param('branch') eq 'NO_LIBRARY_SET'){ # no branch set we can't issue @@ -101,8 +95,6 @@ $findborrower =~ s|,| |g; my $borrowernumber = $query->param('borrowernumber'); $branch = C4::Context->userenv->{'branch'}; -$printer = C4::Context->userenv->{'branchprinter'}; - # If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian if (C4::Context->preference("AutoLocation") != 1) { @@ -661,8 +653,6 @@ $template->param( borrowernumber => $borrowernumber, branch => $branch, branchname => GetBranchName($borrower->{'branchcode'}), - printer => $printer, - printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, showname => $borrower->{'showname'}, diff --git a/circ/returns.pl b/circ/returns.pl index bd60d42..0add27d 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -36,7 +36,6 @@ use C4::Context; use C4::Auth qw/:DEFAULT get_session/; use C4::Output; use C4::Circulation; -use C4::Print; use C4::Reserves; use C4::Biblio; use C4::Items; @@ -73,15 +72,10 @@ my ( $template, $librarian, $cookie ) = get_template_and_user( ##################### #Global vars my $branches = GetBranches(); -my $printers = GetPrinters(); -my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : ""; my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off'); my $userenv_branch = C4::Context->userenv->{'branch'} || ''; -# -# Some code to handle the error if there is no branch or printer setting..... -# # Set up the item stack .... my %returneditems; @@ -605,9 +599,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $template->param( riloop => \@riloop, genbrname => $branches->{$userenv_branch}->{'branchname'}, - genprname => $printers->{$printer}->{'printername'}, branchname => $branches->{$userenv_branch}->{'branchname'}, - printer => $printer, errmsgloop => \@errmsgloop, exemptfine => $exemptfine, dropboxmode => $dropboxmode, diff --git a/circ/selectbranchprinter.pl b/circ/selectbranchprinter.pl index b5adcfc..e3c3d26 100755 --- a/circ/selectbranchprinter.pl +++ b/circ/selectbranchprinter.pl @@ -23,8 +23,7 @@ use CGI; use C4::Context; use C4::Output; -use C4::Auth qw/:DEFAULT get_session/; -use C4::Print; # GetPrinters +use C4::Auth qw/:DEFAULT get_session get_user_printer/; use C4::Koha; use C4::Branch; # GetBranches GetBranchesLoop @@ -56,9 +55,10 @@ my $userenv_printer = C4::Context->userenv->{'branchprinter'} || ''; my @updated; # $session lddines here are doing the updating -if ($branch and $branches->{$branch}) { +my $branch_rec = $branch ? $branches->{$branch} : undef; +if ($branch_rec) { if (! $userenv_branch or $userenv_branch ne $branch ) { - my $branchname = GetBranchName($branch); + my $branchname = $branch_rec->{branchname}; $template->param(LoginBranchname => $branchname); # update template for new branch $template->param(LoginBranchcode => $branch); # update template for new branch $session->param('branchname', $branchname); # update sesssion in DB @@ -67,6 +67,8 @@ if ($branch and $branches->{$branch}) { updated_branch => 1, old_branch => $userenv_branch, }; + $printer ||= $branch_rec->{branchprinter}; + undef $userenv_printer; } # else branch the same, no update } else { $branch = $userenv_branch; # fallback value @@ -87,7 +89,7 @@ if ($printer) { }; } # else printer is the same, no update } else { - $printer = $userenv_printer; # fallback value + $printer = get_user_printer(); # fallback value } $template->param(updated => \@updated) if (scalar @updated); @@ -96,21 +98,6 @@ unless ($branches->{$branch}) { $branch = (keys %$branches)[0]; # if branch didn't really exist, then replace it w/ one that does } -my @printkeys = sort keys %$printers; -if (scalar(@printkeys) == 1 or not $printers->{$printer}) { - $printer = $printkeys[0]; # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does -} - -my @printerloop; -foreach ( @printkeys ) { - next unless ($_); # skip printer if blank. - push @printerloop, { - selected => ( $_ eq $printer ), - name => $printers->{$_}->{'printername'}, - value => $_, - }; -} - my @recycle_loop; foreach ($query->param()) { $_ or next; # disclude blanks @@ -133,9 +120,28 @@ if (scalar @updated and not scalar @recycle_loop) { $template->param( referer => $referer, - printerloop => \@printerloop, branchloop => GetBranchesLoop($branch), recycle_loop=> \@recycle_loop, ); +if ( C4::Context->preference('UsePrintQueues') ) { + my @printkeys = keys %$printers; + if (scalar(@printkeys) == 1 or not $printers->{$printer}) { + $printer = $printkeys[0]; # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does + } + + my @printerloop; + foreach ( @printkeys ) { + push @printerloop, { + selected => ( $_ eq $printer ), + name => $printers->{$_}->{'printername'}, + value => $_, + }; + } + + $template->param( + printerloop => \@printerloop, + ); +} + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 9a94e0f..6e13369 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -362,10 +362,11 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st `branchurl` mediumtext, -- the URL for your library or branch's website `issuing` tinyint(4) default NULL, -- unused in Koha `branchip` varchar(15) default NULL, -- the IP address for your library or branch - `branchprinter` varchar(100) default NULL, -- unused in Koha + `branchprinter` varchar(20) default NULL, `branchnotes` mediumtext, -- notes related to your library or branch opac_info text, -- HTML that displays in OPAC - UNIQUE KEY `branchcode` (`branchcode`) + UNIQUE KEY `branchcode` (`branchcode`), + FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1563,12 +1564,13 @@ CREATE TABLE `pending_offline_operations` ( -- Table structure for table `printers` -- -DROP TABLE IF EXISTS `printers`; -CREATE TABLE `printers` ( - `printername` varchar(40) NOT NULL default '', - `printqueue` varchar(20) default NULL, - `printtype` varchar(20) default NULL, - PRIMARY KEY (`printername`) +DROP TABLE IF EXISTS printers; +CREATE TABLE printers ( + printername varchar(40) NOT NULL default '', + printqueue varchar(20) NOT NULL, + printtype varchar(20) default NULL, + PRIMARY KEY (printqueue), + UNIQUE (printername) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1edf08e..f09000f 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -363,3 +363,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SvcMaxReportRows','10','Maximum number of rows to return via the report web service.',NULL,'Integer'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 035e1e6..91b14cf 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5239,6 +5239,19 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } + + + +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("ALTER TABLE printers DROP PRIMARY KEY, MODIFY printqueue varchar(20) NOT NULL PRIMARY KEY, ADD UNIQUE (printername)"); + $dbh->do("ALTER TABLE branches MODIFY branchprinter varchar(20) NULL, ADD FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo')"); + + print "Upgrade to $DBversion done (Add borrowers.default_printqueue and 'UsePrintQueues' syspref)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 4783523..019a15e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -57,6 +57,9 @@ [% LoginBranchname %] [% END %] + [% IF UsePrintQueues %] + - [% PrinterName %] + [% END %] [% IF ( IndependantBranches ) %] [% IF ( CAN_user_management || CAN_user_editcatalogue_edit_catalogue ) %] ( Set library ) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index ef46ede..0954a8c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -95,8 +95,8 @@
    [% IF ( NoZebra ) %]
    Stop words
    Words ignored during search.
    [% END %] - + [% IF UsePrintQueues %]
    Network Printers
    +
    Printers (UNIX paths).
    [% END %]
    Z39.50 client targets
    Define which servers to query for MARC data in the integrated Z39.50 client.
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index bedeb8b..da70a42 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -143,10 +143,10 @@ tinyMCE.init({
  • Can be entered as a single IP, or a subnet such as 192.168.1.*
  • - +[% END %]
  • @@ -198,7 +198,9 @@ tinyMCE.init({
    - +[% IF UsePrintQueues %] + +[% END %] [% FOREACH branche IN branches %] @@ -250,9 +252,11 @@ tinyMCE.init({ - +[% IF UsePrintQueues %] + +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 471aa0e..d3b804b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -103,6 +103,12 @@ Circulation: - pref: NoticeCSS class: url - on Notices. (This should be a complete URL, starting with http://) + - + - pref: UsePrintQueues + choices: + yes: "Use" + no: "Don't use" + - server print queues. Checkout Policy: - - pref: AllowNotForLoanOverride diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt index 7dfb80b..887c715 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt @@ -89,22 +89,17 @@ [% IF ( searchfield ) %] + [% ELSE %] [% END %]
    -
      [% IF ( searchfield ) %] -
    1. - Printer name: - [% searchfield %] -
    2. - [% ELSE %] +
      1. - +
      2. - [% END %]
      3. @@ -190,7 +185,7 @@
    - + [% END %]
    Overdues ([% overdues_count %] total)
    Address Properties IPPrinter 
    [% branche.branchip %] + [% branche.branchprintername %] + Edit
    [% loo.printername %] [% loo.printqueue %] [% loo.printtype %]Edit DeleteEdit Delete
    [% ELSE %]
    No printers defined.
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index fa92507..86c84f9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -435,7 +435,6 @@ No patron matched [% message %] Patron selection - @@ -522,7 +521,6 @@ No patron matched [% message %]
    [% END %] - [% IF ( CHARGES ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt index acad21c..e742f81 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt @@ -28,7 +28,7 @@ Updated:
      [% IF ( update.updated_branch ) %]
    • Library: [% update.old_branch or "?" %] ⇒ [% update.LoginBranchcode or "?" %]
    • [% ELSIF ( update.updated_printer ) %] - +
    • Printer: [% update.old_printer or "?" %] ⇒ [% update.new_printer or "?" %]
    • [% ELSE %]
    • ERROR - unknown
    • [% END %] @@ -63,7 +63,6 @@ Updated:
        [% END %] [% END %] - + [% END %]
    -- 1.7.9.5 From srdjan at catalyst.net.nz Mon May 14 05:19:08 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Mon, 14 May 2012 15:19:08 +1200 Subject: [Koha-patches] [PATCH] bug_8056: sorted out slip print calls In-Reply-To: References: Message-ID: <1336965548-2782-1-git-send-email-srdjan@catalyst.net.nz> --- C4/Members.pm | 1 - C4/Print.pm | 43 ++++++---------------------------- circ/circulation.pl | 6 ++++- t/db_dependent/lib/KohaTest/Print.pm | 2 +- 4 files changed, 13 insertions(+), 39 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 6161ac9..693e0ba 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -997,7 +997,6 @@ sub GetPendingIssues { # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance # FIXME: namespace collision: each table has "timestamp" fields. Which one is "timestamp" ? # FIXME: circ/ciculation.pl tries to sort by timestamp! - # FIXME: C4::Print::printslip tries to sort by timestamp! # FIXME: namespace collision: other collisions possible. # FIXME: most of this data isn't really being used by callers. my $query = diff --git a/C4/Print.pm b/C4/Print.pm index c0b37c8..9f622a4 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -28,7 +28,7 @@ BEGIN { $VERSION = 3.01; require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(&printslip); + @EXPORT = qw(&NetworkPrint); } =head1 NAME @@ -45,45 +45,16 @@ The functions in this module handle sending text to a printer. =head1 FUNCTIONS -=cut - -=for comment - my $slip = <<"EOF"; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Date: $todaysdate; - -ITEM RESERVED: -$itemdata->{'title'} ($itemdata->{'author'}) -barcode: $itemdata->{'barcode'} - -COLLECT AT: $branchname - -BORROWER: -$bordata->{'surname'}, $bordata->{'firstname'} -card number: $bordata->{'cardnumber'} -Phone: $bordata->{'phone'} -$bordata->{'streetaddress'} -$bordata->{'suburb'} -$bordata->{'town'} -$bordata->{'emailaddress'} +=head2 NetworkPrint + &NetworkPrint($text) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -EOF -=cut - -=head2 printslip - - &printslip($slip) - -print a slip for the given $borrowernumber and $branchcode +Queue some text for printing on the selected branch printer =cut -sub printslip ($) { - my ($slip) = @_; - - return unless ( C4::Context->boolean_preference('printcirculationslips') ); +sub NetworkPrint { + my ($text) = @_; # FIXME - It'd be nifty if this could generate pretty PostScript. @@ -112,7 +83,7 @@ sub printslip ($) { # print $queue; #open (FILE,">/tmp/$file"); - print PRINTER $slip; + print PRINTER $text; print PRINTER "\r\n" x 7 ; close PRINTER; diff --git a/circ/circulation.pl b/circ/circulation.pl index bcbcb6f..c89abff 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -25,6 +25,7 @@ use strict; use warnings; use CGI; use C4::Output; +use C4::Print; use C4::Auth qw/:DEFAULT get_session/; use C4::Dates qw/format_date/; use C4::Branch; # GetBranches @@ -172,7 +173,10 @@ if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { } if ( $print eq 'yes' && $borrowernumber ne '' ) { - PrintIssueSlip($session->param('branch') || $branch, $borrowernumber); + if ( C4::Context->boolean_preference('printcirculationslips') ) { + my $letter = IssueSlip($branch, $borrowernumber, "QUICK"); + NetworkPrint($letter->{content}); + } $query->param( 'borrowernumber', '' ); $borrowernumber = ''; } diff --git a/t/db_dependent/lib/KohaTest/Print.pm b/t/db_dependent/lib/KohaTest/Print.pm index d35ab34..f720fee 100644 --- a/t/db_dependent/lib/KohaTest/Print.pm +++ b/t/db_dependent/lib/KohaTest/Print.pm @@ -12,7 +12,7 @@ sub testing_class { 'C4::Print' }; sub methods : Test( 1 ) { my $self = shift; - my @methods = qw( printslip ); + my @methods = qw( NetworkPrint ); can_ok( $self->testing_class, @methods ); } -- 1.7.9.5 From serhijdubyk at gmail.com Mon May 14 22:29:18 2012 From: serhijdubyk at gmail.com (=?UTF-8?q?Serhij=20Dubyk=20=7B=D0=A1=D0=B5=D1=80=D0=B3=D1=96=D0=B9=20=D0=94=D1=83=D0=B1=D0=B8=D0=BA=7D?=) Date: Mon, 14 May 2012 23:29:18 +0300 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Preservation transparency of png-images cover. Message-ID: <1337027358-32111-1-git-send-email-serhijdubyk@gmail.com> From: Serhij Dubyk {???????????? ??= =?UTF-8?q??????????} Signed-off-by: Serhij Dubyk {???????????? ??????????} --- C4/Images.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/C4/Images.pm b/C4/Images.pm index 8afc8fa..3a8a383 100644 --- a/C4/Images.pm +++ b/C4/Images.pm @@ -187,10 +187,14 @@ sub _scale_image { and warn "Reducing image by " . ( $percent_reduce * 100 ) . "\% or to $width_reduce pix X $height_reduce pix"; - my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ) - ; #'1' creates true color image... + my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ); #'1' creates true color image... + #my $newimage = $image->clone; + $newimage->alphaBlending(0); + $newimage->saveAlpha(1); + #$newimage->transparent( $image->transparent() ); $newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, $height_reduce, $width, $height ); + #$newimage->transparent( $image->transparent() ); return $newimage; } else { -- 1.7.10 From srdjan at catalyst.net.nz Tue May 15 02:20:34 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Tue, 15 May 2012 12:20:34 +1200 Subject: [Koha-patches] [PATCH] bug_5911: Transport Cost Matrix In-Reply-To: References: Message-ID: <1337041234-13490-1-git-send-email-srdjan@catalyst.net.nz> Create transport_cost table, added UseTransportCostMatrix syspref. transport_cost table contains normalised branch to branch transfer costs. These are used for fulilling inter-branch hold transfers. Moved GetHoldsQueueItems() from .pl to HoldsQueue.pm --- C4/Context.pm | 3 + C4/HoldsQueue.pm | 630 ++++++++++++++++++++ admin/systempreferences.pl | 1 + admin/transport-cost-matrix.pl | 122 ++++ circ/view_holdsqueue.pl | 34 +- installer/data/mysql/kohastructure.sql | 17 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 20 + .../prog/en/modules/admin/admin-home.tt | 2 + .../prog/en/modules/admin/transport-cost-matrix.tt | 126 ++++ misc/cronjobs/holds/build_holds_queue.pl | 382 +----------- t/db_dependent/HoldsQueue.t | 161 +++++ 12 files changed, 1087 insertions(+), 412 deletions(-) create mode 100755 C4/HoldsQueue.pm create mode 100755 admin/transport-cost-matrix.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt create mode 100755 t/db_dependent/HoldsQueue.t diff --git a/C4/Context.pm b/C4/Context.pm index 67d31ee..6643c1d 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -523,6 +523,9 @@ with this method. # flushing the caching mechanism. my %sysprefs; +sub _flush_preferences { + %sysprefs = (); +} sub preference { my $self = shift; diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm new file mode 100755 index 0000000..5ed122f --- /dev/null +++ b/C4/HoldsQueue.pm @@ -0,0 +1,630 @@ +package C4::HoldsQueue; + +# Copyright 2011 Catalyst IT +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# FIXME: expand perldoc, explain intended logic + +use strict; +use warnings; + +use C4::Context; +use C4::Search; +use C4::Items; +use C4::Branch; +use C4::Circulation; +use C4::Members; +use C4::Biblio; +use C4::Dates qw/format_date/; + +use List::Util qw(shuffle); +use Data::Dumper; + +use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); +BEGIN { + $VERSION = 3.03; + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw( + &CreateQueue + &GetHoldsQueueItems + + &SetUseTransportCostMatrix + &TransportCostMatrix + &UpdateTransportCostMatrix + ); +} + +# XXX This is not safe in a persistant environment +my $dbh = C4::Context->dbh; + +=head1 FUNCTIONS + +=head2 SetUseTransportCostMatrix + + SetUseTransportCostMatrix($true_false); + +Updates UseTransportCostMatrix syspref + +=cut + +sub SetUseTransportCostMatrix { + my ($bool) = @_; + + $dbh->do("UPDATE systempreferences SET value=? WHERE variable='UseTransportCostMatrix'", undef, $bool ? '1' : '0'); +} + +=head2 TransportCostMatrix + + TransportCostMatrix(); + +Returns Transport Cost Matrix as a hashref => => cost + +=cut + +sub TransportCostMatrix { + my $transport_costs = $dbh->selectall_arrayref("SELECT * FROM transport_cost",{ Slice => {} }); + + my %transport_cost_matrix; + foreach (@$transport_costs) { + my $from = $_->{frombranch}; + my $to = $_->{tobranch}; + my $cost = $_->{cost}; + my $disabled = $_->{disable_transfer}; + $transport_cost_matrix{$to}{$from} = { cost => $cost, disable_transfer => $disabled }; + } + return \%transport_cost_matrix; +} + +=head2 UpdateTransportCostMatrix + + UpdateTransportCostMatrix($records); + +Updates full Transport Cost Matrix table. $records is an arrayref of records. +Records: { frombranch => , tobranch => , cost =>
    , disable_transfer => <0,1> } + +=cut + +sub UpdateTransportCostMatrix { + my ($records) = @_; + + my $sth = $dbh->prepare("INSERT INTO transport_cost (frombranch, tobranch, cost, disable_transfer) VALUES (?, ?, ?, ?)"); + + $dbh->do("TRUNCATE TABLE transport_cost"); + foreach (@$records) { + my $cost = $_->{cost}; + my $from = $_->{frombranch}; + my $to = $_->{tobranch}; + if ( !defined ($cost) || ($cost !~ m/0(\.[0.9]*)?|1(.0*)?/o) ) { + warn "Invalid $from -> $to cost $cost - nust be a decimal number in 0 to 1 range, forcing to 1"; + $cost = 1; + } + $sth->execute( $from, $to, $cost, $_->{disable_transfer} ? 1 : 0 ); + } +} + +=head2 GetHoldsQueueItems + + GetHoldsQueueItems($branch); + +Returns hold queue for a holding branch. If branch is omitted, then whole queue is returned + +=cut + +sub GetHoldsQueueItems { + my ($branchlimit) = @_; + + my @bind_params = (); + my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber + FROM tmp_holdsqueue + JOIN biblio USING (biblionumber) + LEFT JOIN biblioitems USING (biblionumber) + LEFT JOIN items USING ( itemnumber) + /; + if ($branchlimit) { + $query .=" WHERE tmp_holdsqueue.holdingbranch = ?"; + push @bind_params, $branchlimit; + } + $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate"; + my $sth = $dbh->prepare($query); + $sth->execute(@bind_params); + my $items = []; + while ( my $row = $sth->fetchrow_hashref ){ + $row->{reservedate} = format_date($row->{reservedate}); + my $record = GetMarcBiblio($row->{biblionumber}); + if ($record){ + $row->{subtitle} = GetRecordValue('subtitle',$record,'')->[0]->{subfield}; + $row->{parts} = GetRecordValue('parts',$record,'')->[0]->{subfield}; + $row->{numbers} = GetRecordValue('numbers',$record,'')->[0]->{subfield}; + } + push @$items, $row; + } + return $items; +} + +=head2 CreateQueue + + CreateQueue(); + +Top level function that turns reserves into tmp_holdsqueue and hold_fill_targets. + +=cut + +sub CreateQueue { + + $dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info + $dbh->do("DELETE FROM hold_fill_targets"); + + my $total_bibs = 0; + my $total_requests = 0; + my $total_available_items = 0; + my $num_items_mapped = 0; + + my $branches_to_use; + my $transport_cost_matrix; + my $use_transport_cost_matrix = C4::Context->preference("UseTransportCostMatrix"); + if ($use_transport_cost_matrix) { + debug( "Using cost matrix" ); + $transport_cost_matrix = TransportCostMatrix(); + unless (keys %$transport_cost_matrix) { + warn "UseTransportCostMatrix set to yes, but matrix not populated"; + undef $transport_cost_matrix; + } + } + unless ($transport_cost_matrix) { + debug( "Not using cost matrix" ); + $branches_to_use = load_branches_to_pull_from(); + } + + my $bibs_with_pending_requests = GetBibsWithPendingHoldRequests(); + debug( "bibs_with_pending_requests: ".Dumper($bibs_with_pending_requests) ); + + foreach my $biblionumber (@$bibs_with_pending_requests) { + $total_bibs++; + my $hold_requests = GetPendingHoldRequestsForBib($biblionumber); + my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber, $branches_to_use); + $total_requests += scalar(@$hold_requests); + $total_available_items += scalar(@$available_items); + + my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix); + $item_map or next; + my $item_map_size = scalar(keys %$item_map) + or next;; + + $num_items_mapped += $item_map_size; + CreatePicklistFromItemMap($item_map); + AddToHoldTargetMap($item_map); + if (($item_map_size < scalar(@$hold_requests )) and + ($item_map_size < scalar(@$available_items))) { + # DOUBLE CHECK, but this is probably OK - unfilled item-level requests + # FIXME + #warn "unfilled requests for $biblionumber"; + #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map); + } + } +} + +=head2 GetBibsWithPendingHoldRequests + + my $biblionumber_aref = GetBibsWithPendingHoldRequests(); + +Return an arrayref of the biblionumbers of all bibs +that have one or more unfilled hold requests. + +=cut + +sub GetBibsWithPendingHoldRequests { + my $dbh = C4::Context->dbh; + + my $bib_query = "SELECT DISTINCT biblionumber + FROM reserves + WHERE found IS NULL + AND priority > 0 + AND reservedate <= CURRENT_DATE()"; + my $sth = $dbh->prepare($bib_query); + + $sth->execute(); + my $biblionumbers = $sth->fetchall_arrayref(); + + return [ map { $_->[0] } @$biblionumbers ]; +} + +=head2 GetPendingHoldRequestsForBib + + my $requests = GetPendingHoldRequestsForBib($biblionumber); + +Returns an arrayref of hashrefs to pending, unfilled hold requests +on the bib identified by $biblionumber. The following keys +are present in each hashref: + + biblionumber + borrowernumber + itemnumber + priority + branchcode + reservedate + reservenotes + borrowerbranch + +The arrayref is sorted in order of increasing priority. + +=cut + +sub GetPendingHoldRequestsForBib { + my $biblionumber = shift; + + my $dbh = C4::Context->dbh; + + my $request_query = "SELECT biblionumber, borrowernumber, itemnumber, priority, reserves.branchcode, + reservedate, reservenotes, borrowers.branchcode AS borrowerbranch + FROM reserves + JOIN borrowers USING (borrowernumber) + WHERE biblionumber = ? + AND found IS NULL + AND priority > 0 + AND reservedate <= CURRENT_DATE() + ORDER BY priority"; + my $sth = $dbh->prepare($request_query); + $sth->execute($biblionumber); + + my $requests = $sth->fetchall_arrayref({}); + return $requests; + +} + +=head2 GetItemsAvailableToFillHoldRequestsForBib + + my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber, $branches_ar); + +Returns an arrayref of items available to fill hold requests +for the bib identified by C<$biblionumber>. An item is available +to fill a hold request if and only if: + + * it is not on loan + * it is not withdrawn + * it is not marked notforloan + * it is not currently in transit + * it is not lost + * it is not sitting on the hold shelf + +=cut + +sub GetItemsAvailableToFillHoldRequestsForBib { + my ($biblionumber, $branches_to_use) = @_; + + my $dbh = C4::Context->dbh; + my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype + FROM items "; + + if (C4::Context->preference('item-level_itypes')) { + $items_query .= "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) "; + } else { + $items_query .= "JOIN biblioitems USING (biblioitemnumber) + LEFT JOIN itemtypes USING (itemtype) "; + } + $items_query .= "WHERE items.notforloan = 0 + AND holdingbranch IS NOT NULL + AND itemlost = 0 + AND wthdrawn = 0 + AND items.onloan IS NULL + AND (itemtypes.notforloan IS NULL OR itemtypes.notforloan = 0) + AND itemnumber NOT IN ( + SELECT itemnumber + FROM reserves + WHERE biblionumber = ? + AND itemnumber IS NOT NULL + AND (found IS NOT NULL OR priority = 0) + ) + AND items.biblionumber = ?"; + $items_query .= " AND damaged = 0 " + unless C4::Context->preference('AllowHoldsOnDamagedItems'); + + my @params = ($biblionumber, $biblionumber); + if ($branches_to_use && @$branches_to_use) { + $items_query .= " AND holdingbranch IN (" . join (",", map { "?" } @$branches_to_use) . ")"; + push @params, @$branches_to_use; + } + my $sth = $dbh->prepare($items_query); + $sth->execute(@params); + + my $items = $sth->fetchall_arrayref({}); + $items = [ grep { my @transfers = GetTransfers($_->{itemnumber}); $#transfers == -1; } @$items ]; + map { my $rule = GetBranchItemRule($_->{homebranch}, $_->{itype}); $_->{holdallowed} = $rule->{holdallowed}; $rule->{holdallowed} != 0 } @$items; + return [ grep { $_->{holdallowed} != 0 } @$items ]; +} + +=head2 MapItemsToHoldRequests + + MapItemsToHoldRequests($hold_requests, $available_items, $branches, $transport_cost_matrix) + +=cut + +sub MapItemsToHoldRequests { + my ($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix) = @_; + + # handle trival cases + return unless scalar(@$hold_requests) > 0; + return unless scalar(@$available_items) > 0; + + debug( "MapItemsToHoldRequests() for ".Dumper($hold_requests, $available_items, $branches_to_use, $transport_cost_matrix) ); + my $automatic_return = C4::Context->preference("AutomaticItemReturn"); + + # identify item-level requests + my %specific_items_requested = map { $_->{itemnumber} => 1 } + grep { defined($_->{itemnumber}) } + @$hold_requests; + + # group available items by itemnumber + my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items; + + # items already allocated + my %allocated_items = (); + + # map of items to hold requests + my %item_map = (); + + # figure out which item-level requests can be filled + my $num_items_remaining = scalar(@$available_items); + foreach my $request (@$hold_requests) { + last if $num_items_remaining == 0; + + # is this an item-level request? + if (defined($request->{itemnumber})) { + # fill it if possible; if not skip it + if (exists $items_by_itemnumber{$request->{itemnumber}} and + not exists $allocated_items{$request->{itemnumber}}) { + $item_map{$request->{itemnumber}} = { + borrowernumber => $request->{borrowernumber}, + biblionumber => $request->{biblionumber}, + holdingbranch => $items_by_itemnumber{$request->{itemnumber}}->{holdingbranch}, + pickup_branch => $request->{branchcode} || $request->{borrowerbranch}, + item_level => 1, + reservedate => $request->{reservedate}, + reservenotes => $request->{reservenotes}, + }; + $allocated_items{$request->{itemnumber}}++; + $num_items_remaining--; + } + } else { + # it's title-level request that will take up one item + $num_items_remaining--; + } + } + + # group available items by branch + my %items_by_branch = (); + foreach my $item (@$available_items) { + next unless $item->{holdallowed}; + + push @{ $items_by_branch{ $automatic_return ? $item->{homebranch} + : $item->{holdingbranch} } }, $item + unless exists $allocated_items{ $item->{itemnumber} }; + } + return unless keys %items_by_branch; + + # now handle the title-level requests + $num_items_remaining = scalar(@$available_items) - scalar(keys %allocated_items); + my $pull_branches; + foreach my $request (@$hold_requests) { + last if $num_items_remaining == 0; + next if defined($request->{itemnumber}); # already handled these + + # look for local match first + my $pickup_branch = $request->{branchcode} || $request->{borrowerbranch}; + my ($itemnumber, $holdingbranch); + + my $holding_branch_items = $automatic_return ? undef : $items_by_branch{$pickup_branch}; + if ( $holding_branch_items ) { + foreach my $item (@$holding_branch_items) { + if ( $request->{borrowerbranch} eq $item->{homebranch} ) { + $itemnumber = $item->{itemnumber}; + last; + } + } + $holdingbranch = $pickup_branch; + $itemnumber ||= $holding_branch_items->[0]->{itemnumber}; + } + elsif ($transport_cost_matrix) { + $pull_branches = [keys %items_by_branch]; + $holdingbranch = least_cost_branch( $pickup_branch, $pull_branches, $transport_cost_matrix ); + if ( $holdingbranch ) { + + my $holding_branch_items = $items_by_branch{$holdingbranch}; + foreach my $item (@$holding_branch_items) { + next if $request->{borrowerbranch} ne $item->{homebranch}; + + $itemnumber = $item->{itemnumber}; + last; + } + $itemnumber ||= $holding_branch_items->[0]->{itemnumber}; + } + else { + warn "No transport costs for $pickup_branch"; + } + } + + unless ($itemnumber) { + # not found yet, fall back to basics + if ($branches_to_use) { + $pull_branches = $branches_to_use; + } else { + $pull_branches = [keys %items_by_branch]; + } + PULL_BRANCHES: + foreach my $branch (@$pull_branches) { + my $holding_branch_items = $items_by_branch{$branch} + or next; + + $holdingbranch ||= $branch; + foreach my $item (@$holding_branch_items) { + next if $pickup_branch ne $item->{homebranch}; + + $itemnumber = $item->{itemnumber}; + $holdingbranch = $branch; + last PULL_BRANCHES; + } + } + $itemnumber ||= $items_by_branch{$holdingbranch}->[0]->{itemnumber} + if $holdingbranch; + } + + if ($itemnumber) { + my $holding_branch_items = $items_by_branch{$holdingbranch} + or die "Have $itemnumber, $holdingbranch, but no items!"; + @$holding_branch_items = grep { $_->{itemnumber} != $itemnumber } @$holding_branch_items; + delete $items_by_branch{$holdingbranch} unless @$holding_branch_items; + + $item_map{$itemnumber} = { + borrowernumber => $request->{borrowernumber}, + biblionumber => $request->{biblionumber}, + holdingbranch => $holdingbranch, + pickup_branch => $pickup_branch, + item_level => 0, + reservedate => $request->{reservedate}, + reservenotes => $request->{reservenotes}, + }; + $num_items_remaining--; + } + } + return \%item_map; +} + +=head2 CreatePickListFromItemMap + +=cut + +sub CreatePicklistFromItemMap { + my $item_map = shift; + + my $dbh = C4::Context->dbh; + + my $sth_load=$dbh->prepare(" + INSERT INTO tmp_holdsqueue (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber, + cardnumber,reservedate,title, itemcallnumber, + holdingbranch,pickbranch,notes, item_level_request) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + "); + + foreach my $itemnumber (sort keys %$item_map) { + my $mapped_item = $item_map->{$itemnumber}; + my $biblionumber = $mapped_item->{biblionumber}; + my $borrowernumber = $mapped_item->{borrowernumber}; + my $pickbranch = $mapped_item->{pickup_branch}; + my $holdingbranch = $mapped_item->{holdingbranch}; + my $reservedate = $mapped_item->{reservedate}; + my $reservenotes = $mapped_item->{reservenotes}; + my $item_level = $mapped_item->{item_level}; + + my $item = GetItem($itemnumber); + my $barcode = $item->{barcode}; + my $itemcallnumber = $item->{itemcallnumber}; + + my $borrower = GetMember('borrowernumber'=>$borrowernumber); + my $cardnumber = $borrower->{'cardnumber'}; + my $surname = $borrower->{'surname'}; + my $firstname = $borrower->{'firstname'}; + my $phone = $borrower->{'phone'}; + + my $bib = GetBiblioData($biblionumber); + my $title = $bib->{title}; + + $sth_load->execute($biblionumber, $itemnumber, $barcode, $surname, $firstname, $phone, $borrowernumber, + $cardnumber, $reservedate, $title, $itemcallnumber, + $holdingbranch, $pickbranch, $reservenotes, $item_level); + } +} + +=head2 AddToHoldTargetMap + +=cut + +sub AddToHoldTargetMap { + my $item_map = shift; + + my $dbh = C4::Context->dbh; + + my $insert_sql = q( + INSERT INTO hold_fill_targets (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request) + VALUES (?, ?, ?, ?, ?) + ); + my $sth_insert = $dbh->prepare($insert_sql); + + foreach my $itemnumber (keys %$item_map) { + my $mapped_item = $item_map->{$itemnumber}; + $sth_insert->execute($mapped_item->{borrowernumber}, $mapped_item->{biblionumber}, $itemnumber, + $mapped_item->{holdingbranch}, $mapped_item->{item_level}); + } +} + +# Helper functions, not part of any interface + +sub debug { +# warn @_; +} + +sub load_branches_to_pull_from { + my $static_branch_list = C4::Context->preference("StaticHoldsQueueWeight") + or return; + + my @branches_to_use = map { s/^\s+//; s/\s+$//; $_; } split /,/, $static_branch_list; + + @branches_to_use = shuffle(@branches_to_use) if C4::Context->preference("RandomizeHoldsQueueWeight"); + + return \@branches_to_use; +} + +sub least_cost_branch { + + #$from - arrayref + my ($to, $from, $transport_cost_matrix) = @_; + +# Nothing really spectacular: supply to branch, a list of potential from branches +# and find the minimum from - to value from the transport_cost_matrix + return $from->[0] if @$from == 1; + + my ($least_cost, @branch); + foreach (@$from) { + my $cell = $transport_cost_matrix->{$to}{$_}; + next if $cell->{disable_transfer}; + + my $cost = $cell->{cost}; + + unless (defined $least_cost) { + $least_cost = $cost; + push @branch, $_; + next; + } + + next if $cost > $least_cost; + + if ($cost == $least_cost) { + push @branch, $_; + next; + } + + @branch = ($_); + $least_cost = $cost; + } + + return $branch[0]; + + # XXX return a random @branch with minimum cost instead of the first one; + # return $branch[0] if @branch == 1; +} + + +1; diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 5e3848d..cf46e22 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -203,6 +203,7 @@ $tabsysprefs{DisplayClearScreenButton} = "Circulation"; $tabsysprefs{AllowAllMessageDeletion} = "Circulation"; $tabsysprefs{OverdueNoticeBcc} = "Circulation"; $tabsysprefs{OverduesBlockCirc} = "Circulation"; +$tabsysprefs{UseTransportCostMatrix} = "Circulation"; # Staff Client diff --git a/admin/transport-cost-matrix.pl b/admin/transport-cost-matrix.pl new file mode 100755 index 0000000..08865c2 --- /dev/null +++ b/admin/transport-cost-matrix.pl @@ -0,0 +1,122 @@ +#!/usr/bin/perl +# Copyright 2000-2002 Katipo Communications +# copyright 2010 BibLibre +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use strict; +use warnings; +use CGI; +use C4::Context; +use C4::Output; +use C4::Auth; +use C4::Koha; +use C4::Debug; +use C4::Branch; # GetBranches +use C4::HoldsQueue qw(TransportCostMatrix UpdateTransportCostMatrix SetUseTransportCostMatrix); + +use Data::Dumper; + +my $input = new CGI; + +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "admin/transport-cost-matrix.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); + +my $update = $input->param('op') eq 'set-cost-matrix'; +my $use_transport_cost_matrix = $input->param('UseTransportCostMatrix') || 0; + +my ($cost_matrix, $have_matrix); +unless ($update) { + $cost_matrix = TransportCostMatrix(); + $have_matrix = keys %$cost_matrix if $cost_matrix; + $use_transport_cost_matrix = C4::Context->preference("UseTransportCostMatrix"); +} + +my $branches = GetBranches(); +my @branchloop = map { code => $_, + name => $branches->{$_}->{'branchname'} }, + sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } + keys %$branches; +my (@branchfromloop, @cost, @errors); +foreach my $branchfrom ( @branchloop ) { + my $fromcode = $branchfrom->{code}; + + my %from_row = ( code => $fromcode, name => $branchfrom->{name} ); + foreach my $branchto ( @branchloop ) { + my $tocode = $branchto->{code}; + + my %from_to_input_def = ( code => $tocode, name => $branchto->{name} ); + push @{ $from_row{branchtoloop} }, \%from_to_input_def; + + if ($fromcode eq $tocode) { + $from_to_input_def{skip} = 1; + next; + } + + (my $from_to = "${fromcode}_${tocode}") =~ s/\W//go; + $from_to_input_def{id} = $from_to; + my $input_name = "cost_$from_to"; + my $disable_name = "disable_$from_to"; + + if ($update) { + $from_to_input_def{disabled} = 1 if $input->param($disable_name); + my $value = $from_to_input_def{value} = $input->param($input_name); + push @errors, "Invalid value for $from_row{name} -> $from_to_input_def{name}" + unless $value >= 0.0 && $value <= 1.0; + } + else { + if ($have_matrix) { + if ( my $cell = $cost_matrix->{$tocode}{$fromcode} ) { + $from_to_input_def{value} = $cell->{cost}; + $from_to_input_def{disabled} = 1 if $cell->{disable_transfer}; + } + } else { + $from_to_input_def{value} = 0.5; + } + } + } + +# die Dumper(\%from_row); + push @branchfromloop, \%from_row; +} + +if ($update && !@errors) { + my @update_recs = map { + my $from = $_->{code}; + map { frombranch => $from, tobranch => $_->{code}, cost => $_->{value}, disable_transfer => $_->{disabled} || 0 }, + grep { $_->{code} ne $from } + @{ $_->{branchtoloop} }; + } @branchfromloop; + + UpdateTransportCostMatrix(\@update_recs); + SetUseTransportCostMatrix($use_transport_cost_matrix); +} + +$template->param( + branchloop => \@branchloop, + branchfromloop => \@branchfromloop, + UseTransportCostMatrix => $use_transport_cost_matrix, +); +output_html_with_http_headers $input, $cookie, $template->output; + +exit 0; + diff --git a/circ/view_holdsqueue.pl b/circ/view_holdsqueue.pl index 4b51423..cf529f0 100755 --- a/circ/view_holdsqueue.pl +++ b/circ/view_holdsqueue.pl @@ -31,7 +31,7 @@ use C4::Biblio; use C4::Items; use C4::Koha; # GetItemTypes use C4::Branch; # GetBranches -use C4::Dates qw/format_date/; +use C4::HoldsQueue qw(GetHoldsQueueItems); my $query = new CGI; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -51,6 +51,7 @@ my $branchlimit = $params->{'branchlimit'}; my $itemtypeslimit = $params->{'itemtypeslimit'}; if ( $run_report ) { + # XXX GetHoldsQueueItems() does not support $itemtypeslimit! my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit); $template->param( branch => $branchlimit, @@ -76,36 +77,5 @@ $template->param( itemtypeloop => \@itemtypesloop, ); -sub GetHoldsQueueItems { - my ($branchlimit,$itemtypelimit) = @_; - my $dbh = C4::Context->dbh; - - my @bind_params = (); - my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber - FROM tmp_holdsqueue - JOIN biblio USING (biblionumber) - LEFT JOIN biblioitems USING (biblionumber) - LEFT JOIN items USING ( itemnumber) - /; - if ($branchlimit) { - $query .=" WHERE tmp_holdsqueue.holdingbranch = ?"; - push @bind_params, $branchlimit; - } - $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate"; - my $sth = $dbh->prepare($query); - $sth->execute(@bind_params); - my $items = []; - while ( my $row = $sth->fetchrow_hashref ){ - $row->{reservedate} = format_date($row->{reservedate}); - my $record = GetMarcBiblio($row->{biblionumber}); - if ($record){ - $row->{subtitle} = GetRecordValue('subtitle',$record,'')->[0]->{subfield}; - $row->{parts} = GetRecordValue('parts',$record,'')->[0]->{subfield}; - $row->{numbers} = GetRecordValue('numbers',$record,'')->[0]->{subfield}; - } - push @$items, $row; - } - return $items; -} # writing the template output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 9a94e0f..cbe3474 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2785,6 +2785,23 @@ CREATE TABLE `fieldmapping` ( -- koha to keyword mapping ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- +-- Table structure for table `transport_cost` +-- + +DROP TABLE IF EXISTS `transport_cost`; +CREATE TABLE `transport_cost` ( + `frombranch` varchar(10) NOT NULL, + `tobranch` varchar(10) NOT NULL, + `cost` decimal(4,3) NOT NULL, + `disable_transfer` tinyint(1) NOT NULL DEFAULT 0, + CHECK ( `frombranch` <> `tobranch` ), -- a dud check, mysql does not support that + CHECK ( cost >= 0.0 AND cost <= 1.0), -- a dud check, mysql does not support that + PRIMARY KEY (`frombranch`, `tobranch`), + CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -- Table structure for table `biblioimages` -- diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1edf08e..977c1d3 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -324,6 +324,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseTransportCostMatrix',0,"Use Transport Cost Matrix when filling holds",'','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn | a|a d', NULL, NULL, 'Textarea'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 035e1e6..efc4109 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5239,6 +5239,26 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.07.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseTransportCostMatrix',0,'Use Transport Cost Matrix when filling holds','','YesNo')"); + + $dbh->do("CREATE TABLE `transport_cost` ( + `frombranch` varchar(10) NOT NULL, + `tobranch` varchar(10) NOT NULL, + `cost` decimal(4,3) NOT NULL, + `disable_transfer` tinyint(1) NOT NULL DEFAULT 0, + CHECK ( `frombranch` <> `tobranch` ), -- a dud check, mysql does not support that + CHECK ( cost >= 0.0 AND cost <= 1.0), -- a dud check, mysql does not support that + PRIMARY KEY (`frombranch`, `tobranch`), + CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8"); + + print "Upgrade to $DBversion done (creating `transport_cost` table; adding UseTransportCostMatrix systempref, in circulation)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index ef46ede..14486f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -53,6 +53,8 @@
    Define circulation and fines rules for combinations of libraries, patron categories, and item types
    Library transfer limits
    Limit the ability to transfer items between libraries based on the library sending, the library receiving, and the item type involved. These rules only go into effect if the preference UseBranchTransferLimits is set to ON.
    +
    Transport Cost Matrix
    +
    Define transport costs between branches
    Item circulation alerts
    Define rules for check-in and checkout notifications for combinations of libraries, patron categories, and item types
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt new file mode 100644 index 0000000..c426e16 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt @@ -0,0 +1,126 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Administration › Transport Cost Matrix +[% INCLUDE 'doc-head-close.inc' %] + + + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
    + +
    +
    +
    +

    + Defining transport costs between libraries +

    +
    + + +

    Use Transport Cost Matrix +

    +
    +

    Costs are normalised decimal values 0 to 1, 0 being minimum (no) cost, 1 maximum.

    +

    Red cells signify no transfer allowed

    +

    Click on the cell to edit

    +
    + + + + [% FOR b IN branchloop %] + + [% END %] + + [% FOR bf IN branchfromloop %] + + + [% FOR bt IN bf.branchtoloop %] + + [% END %] + + [% END %] +
    From \ To[% b.name %]
    [% bf.name %] + [% IF bt.skip %] +   + [% ELSE %] +
    +
    [% bt.value %]
    + + [% IF bt.disabled %] + + [% END %] +
    + [% END %] +
    +
    + + +
    +
    +
    +
    +[% INCLUDE 'admin-menu.inc' %] +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/misc/cronjobs/holds/build_holds_queue.pl b/misc/cronjobs/holds/build_holds_queue.pl index f01153e..9ec9825 100755 --- a/misc/cronjobs/holds/build_holds_queue.pl +++ b/misc/cronjobs/holds/build_holds_queue.pl @@ -5,7 +5,6 @@ #----------------------------------- # FIXME: add command-line options for verbosity and summary # FIXME: expand perldoc, explain intended logic -# FIXME: refactor all subroutines into C4 for testability use strict; use warnings; @@ -16,384 +15,7 @@ BEGIN { eval { require "$FindBin::Bin/../kohalib.pl" }; } -use C4::Context; -use C4::Search; -use C4::Items; -use C4::Branch; -use C4::Circulation; -use C4::Members; -use C4::Biblio; +use C4::HoldsQueue qw(CreateQueue); -use List::Util qw(shuffle); +CreateQueue(); -my $bibs_with_pending_requests = GetBibsWithPendingHoldRequests(); - -my $dbh = C4::Context->dbh; -$dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info -$dbh->do("DELETE FROM hold_fill_targets"); - -my $total_bibs = 0; -my $total_requests = 0; -my $total_available_items = 0; -my $num_items_mapped = 0; - -my @branches_to_use = _get_branches_to_pull_from(); - -foreach my $biblionumber (@$bibs_with_pending_requests) { - $total_bibs++; - my $hold_requests = GetPendingHoldRequestsForBib($biblionumber); - my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber, @branches_to_use); - $total_requests += scalar(@$hold_requests); - $total_available_items += scalar(@$available_items); - my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, @branches_to_use); - - (defined($item_map)) or next; - - my $item_map_size = scalar(keys %$item_map); - $num_items_mapped += $item_map_size; - CreatePicklistFromItemMap($item_map); - AddToHoldTargetMap($item_map); - if (($item_map_size < scalar(@$hold_requests )) and - ($item_map_size < scalar(@$available_items))) { - # DOUBLE CHECK, but this is probably OK - unfilled item-level requests - # FIXME - #warn "unfilled requests for $biblionumber"; - #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map); - } -} - -exit 0; - -=head1 FUNCTIONS - -=head2 GetBibsWithPendingHoldRequests - - my $biblionumber_aref = GetBibsWithPendingHoldRequests(); - -Return an arrayref of the biblionumbers of all bibs -that have one or more unfilled hold requests. - -=cut - -sub GetBibsWithPendingHoldRequests { - my $dbh = C4::Context->dbh; - - my $bib_query = "SELECT DISTINCT biblionumber - FROM reserves - WHERE found IS NULL - AND priority > 0 - AND reservedate <= CURRENT_DATE()"; - my $sth = $dbh->prepare($bib_query); - - $sth->execute(); - my $biblionumbers = $sth->fetchall_arrayref(); - - return [ map { $_->[0] } @$biblionumbers ]; -} - -=head2 GetPendingHoldRequestsForBib - - my $requests = GetPendingHoldRequestsForBib($biblionumber); - -Returns an arrayref of hashrefs to pending, unfilled hold requests -on the bib identified by $biblionumber. The following keys -are present in each hashref: - - biblionumber - borrowernumber - itemnumber - priority - branchcode - reservedate - reservenotes - borrowerbranch - -The arrayref is sorted in order of increasing priority. - -=cut - -sub GetPendingHoldRequestsForBib { - my $biblionumber = shift; - - my $dbh = C4::Context->dbh; - - my $request_query = "SELECT biblionumber, borrowernumber, itemnumber, priority, reserves.branchcode, - reservedate, reservenotes, borrowers.branchcode AS borrowerbranch - FROM reserves - JOIN borrowers USING (borrowernumber) - WHERE biblionumber = ? - AND found IS NULL - AND priority > 0 - AND reservedate <= CURRENT_DATE() - ORDER BY priority"; - my $sth = $dbh->prepare($request_query); - $sth->execute($biblionumber); - - my $requests = $sth->fetchall_arrayref({}); - return $requests; - -} - -=head2 GetItemsAvailableToFillHoldRequestsForBib - - my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber); - -Returns an arrayref of items available to fill hold requests -for the bib identified by C<$biblionumber>. An item is available -to fill a hold request if and only if: - - * it is not on loan - * it is not withdrawn - * it is not marked notforloan - * it is not currently in transit - * it is not lost - * it is not sitting on the hold shelf - -=cut - -sub GetItemsAvailableToFillHoldRequestsForBib { - my $biblionumber = shift; - my @branches_to_use = @_; - - my $dbh = C4::Context->dbh; - my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype - FROM items "; - - if (C4::Context->preference('item-level_itypes')) { - $items_query .= "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) "; - } else { - $items_query .= "JOIN biblioitems USING (biblioitemnumber) - LEFT JOIN itemtypes USING (itemtype) "; - } - $items_query .= "WHERE items.notforloan = 0 - AND holdingbranch IS NOT NULL - AND itemlost = 0 - AND wthdrawn = 0"; - $items_query .= " AND damaged = 0 " unless C4::Context->preference('AllowHoldsOnDamagedItems'); - $items_query .= " AND items.onloan IS NULL - AND (itemtypes.notforloan IS NULL OR itemtypes.notforloan = 0) - AND itemnumber NOT IN ( - SELECT itemnumber - FROM reserves - WHERE biblionumber = ? - AND itemnumber IS NOT NULL - AND (found IS NOT NULL OR priority = 0) - ) - AND items.biblionumber = ?"; - my @params = ($biblionumber, $biblionumber); - if ($#branches_to_use > -1) { - $items_query .= " AND holdingbranch IN (" . join (",", map { "?" } @branches_to_use) . ")"; - push @params, @branches_to_use; - } - my $sth = $dbh->prepare($items_query); - $sth->execute(@params); - - my $items = $sth->fetchall_arrayref({}); - $items = [ grep { my @transfers = GetTransfers($_->{itemnumber}); $#transfers == -1; } @$items ]; - map { my $rule = GetBranchItemRule($_->{homebranch}, $_->{itype}); $_->{holdallowed} = $rule->{holdallowed}; $rule->{holdallowed} != 0 } @$items; - return [ grep { $_->{holdallowed} != 0 } @$items ]; -} - -=head2 MapItemsToHoldRequests - - MapItemsToHoldRequests($hold_requests, $available_items); - -=cut - -sub MapItemsToHoldRequests { - my $hold_requests = shift; - my $available_items = shift; - my @branches_to_use = @_; - - # handle trival cases - return unless scalar(@$hold_requests) > 0; - return unless scalar(@$available_items) > 0; - - # identify item-level requests - my %specific_items_requested = map { $_->{itemnumber} => 1 } - grep { defined($_->{itemnumber}) } - @$hold_requests; - - # group available items by itemnumber - my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items; - - # items already allocated - my %allocated_items = (); - - # map of items to hold requests - my %item_map = (); - - # figure out which item-level requests can be filled - my $num_items_remaining = scalar(@$available_items); - foreach my $request (@$hold_requests) { - last if $num_items_remaining == 0; - - # is this an item-level request? - if (defined($request->{itemnumber})) { - # fill it if possible; if not skip it - if (exists $items_by_itemnumber{$request->{itemnumber}} and - not exists $allocated_items{$request->{itemnumber}}) { - $item_map{$request->{itemnumber}} = { - borrowernumber => $request->{borrowernumber}, - biblionumber => $request->{biblionumber}, - holdingbranch => $items_by_itemnumber{$request->{itemnumber}}->{holdingbranch}, - pickup_branch => $request->{branchcode}, - item_level => 1, - reservedate => $request->{reservedate}, - reservenotes => $request->{reservenotes}, - }; - $allocated_items{$request->{itemnumber}}++; - $num_items_remaining--; - } - } else { - # it's title-level request that will take up one item - $num_items_remaining--; - } - } - - # group available items by branch - my %items_by_branch = (); - foreach my $item (@$available_items) { - push @{ $items_by_branch{ $item->{holdingbranch} } }, $item unless exists $allocated_items{ $item->{itemnumber} }; - } - - # now handle the title-level requests - $num_items_remaining = scalar(@$available_items) - scalar(keys %allocated_items); - foreach my $request (@$hold_requests) { - last if $num_items_remaining <= 0; - next if defined($request->{itemnumber}); # already handled these - - # look for local match first - my $pickup_branch = $request->{branchcode}; - if (exists $items_by_branch{$pickup_branch} and - not ($items_by_branch{$pickup_branch}->[0]->{holdallowed} == 1 and - $request->{borrowerbranch} ne $items_by_branch{$pickup_branch}->[0]->{homebranch}) - ) { - my $item = pop @{ $items_by_branch{$pickup_branch} }; - delete $items_by_branch{$pickup_branch} if scalar(@{ $items_by_branch{$pickup_branch} }) == 0; - $item_map{$item->{itemnumber}} = { - borrowernumber => $request->{borrowernumber}, - biblionumber => $request->{biblionumber}, - holdingbranch => $pickup_branch, - pickup_branch => $pickup_branch, - item_level => 0, - reservedate => $request->{reservedate}, - reservenotes => $request->{reservenotes}, - }; - $num_items_remaining--; - } else { - my @pull_branches = (); - if ($#branches_to_use > -1) { - @pull_branches = @branches_to_use; - } else { - @pull_branches = sort keys %items_by_branch; - } - foreach my $branch (@pull_branches) { - next unless exists $items_by_branch{$branch} and - not ($items_by_branch{$branch}->[0]->{holdallowed} == 1 and - $request->{borrowerbranch} ne $items_by_branch{$branch}->[0]->{homebranch}); - my $item = pop @{ $items_by_branch{$branch} }; - delete $items_by_branch{$branch} if scalar(@{ $items_by_branch{$branch} }) == 0; - $item_map{$item->{itemnumber}} = { - borrowernumber => $request->{borrowernumber}, - biblionumber => $request->{biblionumber}, - holdingbranch => $branch, - pickup_branch => $pickup_branch, - item_level => 0, - reservedate => $request->{reservedate}, - reservenotes => $request->{reservenotes}, - }; - $num_items_remaining--; - last; - } - } - } - return \%item_map; -} - -=head2 CreatePickListFromItemMap - -=cut - -sub CreatePicklistFromItemMap { - my $item_map = shift; - - my $dbh = C4::Context->dbh; - - my $sth_load=$dbh->prepare(" - INSERT INTO tmp_holdsqueue (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber, - cardnumber,reservedate,title, itemcallnumber, - holdingbranch,pickbranch,notes, item_level_request) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) - "); - - foreach my $itemnumber (sort keys %$item_map) { - my $mapped_item = $item_map->{$itemnumber}; - my $biblionumber = $mapped_item->{biblionumber}; - my $borrowernumber = $mapped_item->{borrowernumber}; - my $pickbranch = $mapped_item->{pickup_branch}; - my $holdingbranch = $mapped_item->{holdingbranch}; - my $reservedate = $mapped_item->{reservedate}; - my $reservenotes = $mapped_item->{reservenotes}; - my $item_level = $mapped_item->{item_level}; - - my $item = GetItem($itemnumber); - my $barcode = $item->{barcode}; - my $itemcallnumber = $item->{itemcallnumber}; - - my $borrower = GetMember('borrowernumber'=>$borrowernumber); - my $cardnumber = $borrower->{'cardnumber'}; - my $surname = $borrower->{'surname'}; - my $firstname = $borrower->{'firstname'}; - my $phone = $borrower->{'phone'}; - - my $bib = GetBiblioData($biblionumber); - my $title = $bib->{title}; - - $sth_load->execute($biblionumber, $itemnumber, $barcode, $surname, $firstname, $phone, $borrowernumber, - $cardnumber, $reservedate, $title, $itemcallnumber, - $holdingbranch, $pickbranch, $reservenotes, $item_level); - } -} - -=head2 AddToHoldTargetMap - -=cut - -sub AddToHoldTargetMap { - my $item_map = shift; - - my $dbh = C4::Context->dbh; - - my $insert_sql = q( - INSERT INTO hold_fill_targets (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request) - VALUES (?, ?, ?, ?, ?) - ); - my $sth_insert = $dbh->prepare($insert_sql); - - foreach my $itemnumber (keys %$item_map) { - my $mapped_item = $item_map->{$itemnumber}; - $sth_insert->execute($mapped_item->{borrowernumber}, $mapped_item->{biblionumber}, $itemnumber, - $mapped_item->{holdingbranch}, $mapped_item->{item_level}); - } -} - -=head2 _get_branches_to_pull_from - -Query system preferences to get ordered list of -branches to use to fill hold requests. - -=cut - -sub _get_branches_to_pull_from { - my @branches_to_use = (); - - my $static_branch_list = C4::Context->preference("StaticHoldsQueueWeight"); - if ($static_branch_list) { - @branches_to_use = map { s/^\s+//; s/\s+$//; $_; } split /,/, $static_branch_list; - } - - @branches_to_use = shuffle(@branches_to_use) if C4::Context->preference("RandomizeHoldsQueueWeight"); - - return @branches_to_use; -} diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t new file mode 100755 index 0000000..6cce4d9 --- /dev/null +++ b/t/db_dependent/HoldsQueue.t @@ -0,0 +1,161 @@ +#!/usr/bin/perl + +# Test C4::HoldsQueue::CreateQueue() for both transport cost matrix +# and StaticHoldsQueueWeight array (no RandomizeHoldsQueueWeight, no point) +# Wraps tests in transaction that's rolled back, so no data is destroyed +# MySQL WARNING: This makes sense only if your tables are InnoDB, otherwise +# transactions are not supported and mess is left behind + +use strict; +use warnings; +use C4::Context; + +use Data::Dumper; + +use Test::More tests => 15; + +BEGIN { + use FindBin; + use lib $FindBin::Bin; + use_ok('C4::Reserves'); + use_ok('C4::HoldsQueue'); +} + +my $TITLE = "Test Holds Queue XXX"; +# Pick a plausible borrower. Easier than creating one. +my $BORROWER_QRY = <dbh; +my $borrower = $dbh->selectrow_hashref($BORROWER_QRY); +my $borrowernumber = $borrower->{borrowernumber}; +# Set special (for this test) branches +my $borrower_branchcode = $borrower->{branchcode}; +my @other_branches = grep { $_ ne $borrower_branchcode } @{ $dbh->selectcol_arrayref("SELECT branchcode FROM branches") }; +my $least_cost_branch_code = pop @other_branches + or BAIL_OUT("No point testing only one branch..."); + +# Start transaction +$dbh->{AutoCommit} = 0; +$dbh->{RaiseError} = 1; + +#Set up the stage +# Sysprefs and cost matrix +$dbh->do("UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'", undef, + join( ',', @other_branches, $borrower_branchcode, $least_cost_branch_code)); +$dbh->do("UPDATE systempreferences SET value = '0' WHERE variable = 'RandomizeHoldsQueueWeight'"); + +$dbh->do("DELETE FROM transport_cost"); +my $transport_cost_insert_sth = $dbh->prepare("insert into transport_cost (frombranch, tobranch, cost) values (?, ?, ?)"); +# Favour $least_cost_branch_code +$transport_cost_insert_sth->execute($borrower_branchcode, $least_cost_branch_code, 0.2); +$transport_cost_insert_sth->execute($least_cost_branch_code, $borrower_branchcode, 0.2); +my @b = @other_branches; +while ( my $b1 = shift @b ) { + foreach my $b2 ($borrower_branchcode, $least_cost_branch_code, @b) { + $transport_cost_insert_sth->execute($b1, $b2, 0.5); + $transport_cost_insert_sth->execute($b2, $b1, 0.5); + } +} + + +# Loanable items - all possible combinations of homebranch and holdingbranch +$dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) + VALUES ('SER', 'Koha test', '$TITLE', '2011-02-01')"); +my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'") + or BAIL_OUT("Cannot find newly created biblio record"); +$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml) + VALUES ($biblionumber, '')"); +my $biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber") + or BAIL_OUT("Cannot find newly created biblioitems record"); + +my $items_insert_sth = $dbh->prepare("INSERT INTO items (biblionumber, biblioitemnumber, barcode, homebranch, holdingbranch, notforloan, damaged, itemlost, wthdrawn, onloan) + VALUES ($biblionumber, $biblioitemnumber, ?, ?, ?, 0, 0, 0, 0, NULL)"); # CURRENT_DATE - 3)"); +my $first_barcode = int(rand(1000000000000)); # XXX +my $barcode = $first_barcode; +foreach ( $borrower_branchcode, $least_cost_branch_code, @other_branches ) { + $items_insert_sth->execute($barcode++, $borrower_branchcode, $_); + $items_insert_sth->execute($barcode++, $_, $_); + $items_insert_sth->execute($barcode++, $_, $borrower_branchcode); +} + +# Remove existing reserves, makes debugging easier +$dbh->do("DELETE FROM reserves"); +my $constraint = undef; +my $bibitems = undef; +my $priority = 1; +# Make a reserve +AddReserve ( $borrower_branchcode, $borrowernumber, $biblionumber, $constraint, $bibitems, $priority ); +# $resdate, $expdate, $notes, $title, $checkitem, $found +$dbh->do("UPDATE reserves SET reservedate = reservedate - 1"); + +# Tests +my $use_cost_matrix_sth = $dbh->prepare("UPDATE systempreferences SET value = ? WHERE variable = 'UseTransportCostMatrix'"); +my $test_sth = $dbh->prepare("SELECT * FROM hold_fill_targets + JOIN tmp_holdsqueue USING (borrowernumber, biblionumber, itemnumber) + JOIN items USING (itemnumber) + WHERE borrowernumber = $borrowernumber"); + +# We have a book available homed in borrower branch +test_queue ('take from homebranch', 0, $borrower_branchcode, $borrower_branchcode); +test_queue ('take from homebranch', 1, $borrower_branchcode, $borrower_branchcode); + +$dbh->do("DELETE FROM tmp_holdsqueue"); +$dbh->do("DELETE FROM hold_fill_targets"); +$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE homebranch = '$borrower_branchcode')"); +$dbh->do("DELETE FROM items WHERE homebranch = '$borrower_branchcode'"); +# We have a book available held in borrower branch +test_queue ('take from holdingbranch', 0, $borrower_branchcode, $borrower_branchcode); +test_queue ('take from holdingbranch', 1, $borrower_branchcode, $borrower_branchcode); + +$dbh->do("DELETE FROM tmp_holdsqueue"); +$dbh->do("DELETE FROM hold_fill_targets"); +$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE holdingbranch = '$borrower_branchcode')"); +$dbh->do("DELETE FROM items WHERE holdingbranch = '$borrower_branchcode'"); +# No book available in borrower branch, pick according to the rules +# Frst branch from StaticHoldsQueueWeight +test_queue ('take from lowest cost branch', 0, $borrower_branchcode, $other_branches[0]); +test_queue ('take from lowest cost branch', 1, $borrower_branchcode, $least_cost_branch_code); +my $queue = C4::HoldsQueue::GetHoldsQueueItems($least_cost_branch_code) || []; +my $queue_item = $queue->[0]; +ok( $queue_item + && $queue_item->{pickbranch} eq $borrower_branchcode + && $queue_item->{holdingbranch} eq $least_cost_branch_code, "GetHoldsQueueItems" ) + or diag( "Expected item for pick $borrower_branchcode, hold $least_cost_branch_code, got ".Dumper($queue_item) ); + +# XXX All this tests are for borrower branch pick-up. +# Maybe needs expanding to homebranch or holdingbranch pick-up. + +# Cleanup +$dbh->rollback; + +exit; + +sub test_queue { + my ($test_name, $use_cost_matrix, $pick_branch, $hold_branch) = @_; + + $test_name = "$test_name (".($use_cost_matrix ? "" : "don't")." use cost matrix)"; + + $use_cost_matrix_sth->execute($use_cost_matrix); + C4::Context->_flush_preferences(); + C4::HoldsQueue::CreateQueue(); + + my $results = $dbh->selectall_arrayref($test_sth, { Slice => {} }); # should be only one + my $r = $results->[0]; + + my $ok = is( $r->{pickbranch}, $pick_branch, "$test_name pick up branch"); + $ok &&= is( $r->{holdingbranch}, $hold_branch, "$test_name holding branch") + if $hold_branch; + + diag( "Wrong pick-up/hold: ". Dumper ($pick_branch,, $hold_branch, map dump_records($_), qw(reserves hold_fill_targets tmp_holdsqueue)) ) + unless $ok; +} + +sub dump_records { + my ($tablename) = @_; + return $dbh->selectall_arrayref("SELECT * from $tablename where borrowernumber = ?", { Slice => {} }, $borrowernumber); +} + + -- 1.7.9.5 From mtj at kohaaloha.com Tue May 15 05:39:37 2012 From: mtj at kohaaloha.com (Mason James) Date: Tue, 15 May 2012 15:39:37 +1200 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Preservation transparency of png-images cover. In-Reply-To: <1337027358-32111-1-git-send-email-serhijdubyk@gmail.com> References: <1337027358-32111-1-git-send-email-serhijdubyk@gmail.com> Message-ID: <703D8F4A-7558-4D35-9787-264DB21768B0@kohaaloha.com> On 2012-05-15, at 8:29 AM, Serhij Dubyk {?????? ?????} wrote: > From: Serhij Dubyk {???????????? ??= =?UTF-8?q??????????} > > > Signed-off-by: Serhij Dubyk {???????????? ??????????} > --- > C4/Images.pm | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/C4/Images.pm b/C4/Images.pm > index 8afc8fa..3a8a383 100644 > --- a/C4/Images.pm > +++ b/C4/Images.pm > @@ -187,10 +187,14 @@ sub _scale_image { > and warn "Reducing image by " > . ( $percent_reduce * 100 ) > . "\% or to $width_reduce pix X $height_reduce pix"; > - my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ) > - ; #'1' creates true color image... > + my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ); #'1' creates true color image... > + #my $newimage = $image->clone; > + $newimage->alphaBlending(0); > + $newimage->saveAlpha(1); > + #$newimage->transparent( $image->transparent() ); > $newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, > $height_reduce, $width, $height ); > + #$newimage->transparent( $image->transparent() ); > return $newimage; > } > else { > -- > 1.7.10 > hmmm, a bugzilla ticket would help to ensure this important patch does not get lost... -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 535 bytes Desc: This is a digitally signed message part URL: From srdjan at catalyst.net.nz Tue May 15 07:05:20 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Tue, 15 May 2012 17:05:20 +1200 Subject: [Koha-patches] [PATCH] bug_8083: parameters subpermissions: manage_circ_rules and parameters_remaining_permissions In-Reply-To: References: Message-ID: <1337058320-20541-1-git-send-email-srdjan@catalyst.net.nz> --- admin/admin-home.pl | 2 +- admin/auth_subfields_structure.pl | 2 +- admin/auth_tag_structure.pl | 2 +- admin/authorised_values.pl | 2 +- admin/authtypes.pl | 2 +- admin/biblio_framework.pl | 2 +- admin/branches.pl | 2 +- admin/categorie.pl | 2 +- admin/checkmarc.pl | 2 +- admin/cities.pl | 2 +- admin/classsources.pl | 2 +- admin/clone-rules.pl | 2 +- admin/currency.pl | 2 +- admin/env_tz_test.pl | 2 +- admin/fieldmapping.pl | 2 +- admin/item_circulation_alerts.pl | 2 +- admin/itemtypes.pl | 2 +- admin/koha2marclinks.pl | 2 +- admin/marc_subfields_structure.pl | 2 +- admin/marctagstructure.pl | 2 +- admin/matching-rules.pl | 2 +- admin/oai_set_mappings.pl | 2 +- admin/oai_sets.pl | 2 +- admin/patron-attr-types.pl | 2 +- admin/preferences.pl | 2 +- admin/printers.pl | 2 +- admin/roadtype.pl | 2 +- admin/smart-rules.pl | 2 +- admin/stopwords.pl | 2 +- admin/systempreferences.pl | 2 +- admin/z3950servers.pl | 2 +- .../data/mysql/en/mandatory/userpermissions.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 18 ++++++++++++++++++ .../prog/en/modules/admin/admin-home.tt | 2 ++ 34 files changed, 53 insertions(+), 31 deletions(-) diff --git a/admin/admin-home.pl b/admin/admin-home.pl index ad7a897..2d60b0a 100755 --- a/admin/admin-home.pl +++ b/admin/admin-home.pl @@ -30,7 +30,7 @@ my ($template, $loggedinuser, $cookie) query => $query, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => '*'}, debug => 1, }); diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl index 432d496..537f0ea 100755 --- a/admin/auth_subfields_structure.pl +++ b/admin/auth_subfields_structure.pl @@ -57,7 +57,7 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl index bd3dc93..587b27f 100755 --- a/admin/auth_tag_structure.pl +++ b/admin/auth_tag_structure.pl @@ -50,7 +50,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index 1545f0e..949e488 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -55,7 +55,7 @@ our $dbh = C4::Context->dbh; our ($template, $borrowernumber, $cookie)= get_template_and_user({ template_name => "admin/authorised_values.tmpl", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, query => $input, type => "intranet", debug => 1, diff --git a/admin/authtypes.pl b/admin/authtypes.pl index 250a89c..9869372 100755 --- a/admin/authtypes.pl +++ b/admin/authtypes.pl @@ -45,7 +45,7 @@ my ($template, $borrowernumber, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index f2c147e..e2130cf 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -47,7 +47,7 @@ my ($template, $borrowernumber, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/branches.pl b/admin/branches.pl index c12762d..d172ea6 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -63,7 +63,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1}, + flagsrequired => { parameters => 'parameters_remaining_permissions'}, debug => 1, } ); diff --git a/admin/categorie.pl b/admin/categorie.pl index 521346b..51e736a 100755 --- a/admin/categorie.pl +++ b/admin/categorie.pl @@ -73,7 +73,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/checkmarc.pl b/admin/checkmarc.pl index e08796f..8523b02 100755 --- a/admin/checkmarc.pl +++ b/admin/checkmarc.pl @@ -34,7 +34,7 @@ my ($template, $borrowernumber, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/cities.pl b/admin/cities.pl index 0303a48..378ceda 100755 --- a/admin/cities.pl +++ b/admin/cities.pl @@ -41,7 +41,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/classsources.pl b/admin/classsources.pl index 45183cd..e7f6c9a 100755 --- a/admin/classsources.pl +++ b/admin/classsources.pl @@ -40,7 +40,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/clone-rules.pl b/admin/clone-rules.pl index dcf4abe..c9e4665 100755 --- a/admin/clone-rules.pl +++ b/admin/clone-rules.pl @@ -43,7 +43,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/currency.pl b/admin/currency.pl index e24f6b6..aa878fd 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -57,7 +57,7 @@ our ($template, $loggedinuser, $cookie) = get_template_and_user({ template_name => 'admin/currency.tmpl', query => $input, type => 'intranet', - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, authnotrequired => 0, }); diff --git a/admin/env_tz_test.pl b/admin/env_tz_test.pl index 5bd5cd7..876e546 100755 --- a/admin/env_tz_test.pl +++ b/admin/env_tz_test.pl @@ -14,7 +14,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ query => $q, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/fieldmapping.pl b/admin/fieldmapping.pl index f7eca3c..2856e70 100755 --- a/admin/fieldmapping.pl +++ b/admin/fieldmapping.pl @@ -39,7 +39,7 @@ my ($template, $loggedinuser, $cookie) query => $query, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/item_circulation_alerts.pl b/admin/item_circulation_alerts.pl index ee77ae8..2bfb496 100755 --- a/admin/item_circulation_alerts.pl +++ b/admin/item_circulation_alerts.pl @@ -65,7 +65,7 @@ sub show { query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => defined($input->param('debug')), } ); diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 3219da3..841672d 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -77,7 +77,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl index a89681d..fc320ad 100755 --- a/admin/koha2marclinks.pl +++ b/admin/koha2marclinks.pl @@ -39,7 +39,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index bc6636a..365a861 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -72,7 +72,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index a86d788..2d7d913 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -52,7 +52,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/matching-rules.pl b/admin/matching-rules.pl index b167026..2fa2ac6 100755 --- a/admin/matching-rules.pl +++ b/admin/matching-rules.pl @@ -39,7 +39,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/oai_set_mappings.pl b/admin/oai_set_mappings.pl index 4d570f9..1a9762c 100755 --- a/admin/oai_set_mappings.pl +++ b/admin/oai_set_mappings.pl @@ -45,7 +45,7 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { query => $input, type => 'intranet', authnotrequired => 0, - flagsrequired => { 'parameters' => '*' }, + flagsrequired => { 'parameters' => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/oai_sets.pl b/admin/oai_sets.pl index a826107..c923e87 100755 --- a/admin/oai_sets.pl +++ b/admin/oai_sets.pl @@ -41,7 +41,7 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { query => $input, type => 'intranet', authnotrequired => 0, - flagsrequired => { 'parameters' => '*' }, + flagsrequired => { 'parameters' => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index 638456e..c0ad1f7 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -42,7 +42,7 @@ our ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/preferences.pl b/admin/preferences.pl index 0dcec19..b1ad005 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -261,7 +261,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/printers.pl b/admin/printers.pl index c32b4e6..79c9949 100755 --- a/admin/printers.pl +++ b/admin/printers.pl @@ -72,7 +72,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/roadtype.pl b/admin/roadtype.pl index a756594..a75c0dc 100755 --- a/admin/roadtype.pl +++ b/admin/roadtype.pl @@ -43,7 +43,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 8e5a2d5..cb35214 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -38,7 +38,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'manage_circ_rules'}, debug => 1, }); diff --git a/admin/stopwords.pl b/admin/stopwords.pl index 7a24af7..a64745f 100755 --- a/admin/stopwords.pl +++ b/admin/stopwords.pl @@ -48,7 +48,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "admin/stopwords.tmpl", query => $input, type => "intranet", - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, authnotrequired => 0, debug => 1, }); diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 5e3848d..078f5e8 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -592,7 +592,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl index 3bc0ef2..8d5ebdc 100755 --- a/admin/z3950servers.pl +++ b/admin/z3950servers.pl @@ -75,7 +75,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql index 873089a..4f05b15 100644 --- a/installer/data/mysql/en/mandatory/userpermissions.sql +++ b/installer/data/mysql/en/mandatory/userpermissions.sql @@ -1,6 +1,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 035e1e6..a251847 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5239,6 +5239,24 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } + + + +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules')"); + $dbh->do("INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'parameters_remaining_permissions' + FROM borrowers WHERE flags & (1 << 3)"); + $dbh->do("INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_circ_rules' + FROM borrowers WHERE flags & (1 << 3)"); + print "Upgrade to $DBversion done (Added parameters subpermissions)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index ef46ede..1d08028 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -49,8 +49,10 @@
    Define road types (street, avenue, way, etc.). Road types display as authorized values when adding/editing patrons and can be used in geographic statistics.
    Patron attribute types
    Define extended attributes (identifiers and statistical categories) for patron records
    +[% IF CAN_user_parameters_manage_circ_rules %]
    Circulation and fines rules
    Define circulation and fines rules for combinations of libraries, patron categories, and item types
    +[% END %]
    Library transfer limits
    Limit the ability to transfer items between libraries based on the library sending, the library receiving, and the item type involved. These rules only go into effect if the preference UseBranchTransferLimits is set to ON.
    Item circulation alerts
    -- 1.7.9.5 From oleonard at myacpl.org Tue May 15 20:37:03 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Tue, 15 May 2012 14:37:03 -0400 Subject: [Koha-patches] =?utf-8?q?=5BPATCH=5D_Bug_7500_=5BFOLLOW-UP=5D_Use?= =?utf-8?q?_CSS_Sprites_for_faster_page_loading?= Message-ID: <1337107023-5038-1-git-send-email-oleonard@myacpl.org> This patch adds a new sprite image for social network links. The page markup has been modified to accommodate the image- replacement technique used to display the images. When testing be sure to clear your cache to load the new CSS. --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 42 ++++++++++++++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 14 +++---- koha-tmpl/opac-tmpl/prog/images/social-sprite.png | Bin 0 -> 2802 bytes 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/images/social-sprite.png diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 0cc7f2d..f0690d8 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2405,6 +2405,48 @@ span.sep { text-shadow: 1px 1px 0 #FFF; } +#social_networks span { + color: #274D7F; + display : block; + float : left; + font-size: 85%; + font-weight: bold; + line-height: 2em; + margin : .5em 0 .5em .5em !important; +} +#social_networks a { + background: transparent url("../../images/social-sprite.png") no-repeat; + display: block; + height : 20px !important; + width : 20px; + text-indent : -999em; +} + +#social_networks div { + float : left !important; + margin : .5em 0 .5em .2em !important; +} + +#social_networks #facebook { + background-position : -7px -35px; +} + +#social_networks #twitter { + background-position : -7px -5px; +} + +#social_networks #linkedin { + background-position : -7px -95px; +} + +#social_networks #delicious { + background-position : -7px -66px; +} + +#social_networks #email { + background-position : -7px -126px; +} + /* ## BABELTHEQUE ##?*/ /* Uncomment if babeltheque configuration no contains these lines */ /* diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index cc59fb2..2ab8f80 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1206,14 +1206,14 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %] [% IF ( SocialNetworks ) %] -
    Delete
    No [% IF ( branchcategorie.properties ) %]properties[% ELSIF ( branchcategorie.searchdomain ) %]search domain[% END %] defined
    No [% IF ( branchcategorie.properties ) %]properties[% ELSIF ( branchcategorie.searchdomain ) %]search domain[% END %] defined. Add a new group.
    [% END %] [% ELSE %] -- 1.7.9.5 From oleonard at myacpl.org Fri May 18 16:54:17 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 18 May 2012 10:54:17 -0400 Subject: [Koha-patches] [PATCH] Bug 8124 - Hide option to download results of items with no checkouts report Message-ID: <1337352857-20935-1-git-send-email-oleonard@myacpl.org> We should not show disabled controls for features which don't work. --- .../prog/en/modules/reports/catalogue_out.tt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt index 281fa66..23eb6ba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt @@ -139,11 +139,11 @@ - + +
  • -- 1.7.9.5 From oleonard at myacpl.org Fri May 18 17:53:51 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 18 May 2012 11:53:51 -0400 Subject: [Koha-patches] [PATCH] Bug 8107 - Disabled buttons not distinguishable from enabled buttons Message-ID: <1337356431-22308-1-git-send-email-oleonard@myacpl.org> Add a "greyed-out" style for disabled buttons. Having looked through the templates for examples of usage of this I'm not convinced that we should really be showing disabled buttons. I think in general it would be better to hide or show a button based on whether the action is available. --- .../intranet-tmpl/prog/en/css/staff-global.css | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 0835187..2658964 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -1713,6 +1713,16 @@ input[type=submit], input[type=reset], input[type=button], input.submit, button. color: #333333; } +input[type=submit]:disabled, +input[type=reset]:disabled, +input[type=button]:disabled, +input.submit:disabled, +button.submit:disabled { + color : #999; + border : 1px solid #C0C0C0; + background : #EEE none; +} + input[type=reset]:active, input[type=button]:active, input.submit:active, button.submit:active { border : 1px inset #999999; } -- 1.7.9.5 From oleonard at myacpl.org Fri May 18 18:55:22 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Fri, 18 May 2012 12:55:22 -0400 Subject: [Koha-patches] [PATCH] Bug 8095 - Printed lists in the OPAC not easy to read Message-ID: <1337360122-22700-1-git-send-email-oleonard@myacpl.org> Adding more details to the print stylesheet to better adapt the layout for printing. Testers please clear your browser cache to ensure you have the updated CSS file and test multiple pages, not just the lists page. --- koha-tmpl/opac-tmpl/prog/en/css/print.css | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/print.css b/koha-tmpl/opac-tmpl/prog/en/css/print.css index b5a904a..db8b21b 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/print.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/print.css @@ -200,7 +200,7 @@ body#basket p { padding:0pt; } -#members,#opac-main-search,#opac-user-views .ui-tabs-nav,input,h2 span.hint,td.resultscontrol,.pages,.suggestion,.views,#action,#export,#bibliodescriptions .ui-tabs-nav,#addshelf,fieldset.action, .list-actions, .ft, #facetcontainer { +#members,#opac-main-search,#opac-user-views .ui-tabs-nav,input,h2 span.hint,td.resultscontrol,.pages,.suggestion,.views,#action,#export,#bibliodescriptions .ui-tabs-nav,#addshelf,fieldset.action, .list-actions, .ft, #facetcontainer,.results_summary.actions,.koha_url,.yui-b { display : none; } @@ -215,3 +215,13 @@ div#userupdate input,div#userupdate textarea { display : inline; border : 0; } + +#yui-main, +#yui-main .yui-b, +.yui-t1 #yui-main .yui-b { + display : block !important; + margin : 0 !important; + padding : 0 !important; + width : auto !important; + float : none !important; +} -- 1.7.9.5 From wizzyrea at gmail.com Fri May 18 19:11:48 2012 From: wizzyrea at gmail.com (Liz Rea) Date: Fri, 18 May 2012 12:11:48 -0500 Subject: [Koha-patches] [PATCH] Bug 8125 - Adds zipcode to address output Message-ID: <1337361108-14250-1-git-send-email-wizzyrea@gmail.com> Please test thoroughly - also, I don't know if there is a specific field that SIP expects zipcode to be in. If there is, this patch probably won't fix the issue. To test: fetch a valid patron using SIP. The Address field should have the zipcode included. --- C4/SIP/ILS/Patron.pm | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 99fd6e7..a3c805b 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -61,11 +61,12 @@ sub new { my %ilspatron; my $adr = $kp->{streetnumber} || ''; my $address = $kp->{address} || ''; + my $zip = $kp->{zipcode} || ''; my $dob = $kp->{dateofbirth}; $dob and $dob =~ s/-//g; # YYYYMMDD my $dexpiry = $kp->{dateexpiry}; $dexpiry and $dexpiry =~ s/-//g; # YYYYMMDD - $adr .= ($adr && $address) ? " $address" : $address; + $adr .= ($adr && $address && $zip) ? " $address" : $address; my $fines_amount = $flags->{CHARGES}->{amount}; $fines_amount = ($fines_amount and $fines_amount > 0) ? $fines_amount : 0; { -- 1.7.2.5 From srdjan at catalyst.net.nz Tue May 22 07:58:18 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Tue, 22 May 2012 17:58:18 +1200 Subject: [Koha-patches] =?utf-8?q?=5BPATCH=5D_bug=5F8083=3A_parameters_sub?= =?utf-8?q?permissions=3A_manage=5Fcirc=5Frules_and_parameters=5Fre?= =?utf-8?q?maining=5Fpermissions?= In-Reply-To: References: Message-ID: <1337666298-30695-1-git-send-email-srdjan@catalyst.net.nz> --- admin/admin-home.pl | 2 +- admin/auth_subfields_structure.pl | 2 +- admin/auth_tag_structure.pl | 2 +- admin/authorised_values.pl | 2 +- admin/authtypes.pl | 2 +- admin/biblio_framework.pl | 2 +- admin/branches.pl | 2 +- admin/categorie.pl | 2 +- admin/checkmarc.pl | 2 +- admin/cities.pl | 2 +- admin/classsources.pl | 2 +- admin/clone-rules.pl | 2 +- admin/currency.pl | 2 +- admin/env_tz_test.pl | 2 +- admin/fieldmapping.pl | 2 +- admin/item_circulation_alerts.pl | 2 +- admin/itemtypes.pl | 2 +- admin/koha2marclinks.pl | 2 +- admin/marc_subfields_structure.pl | 2 +- admin/marctagstructure.pl | 2 +- admin/matching-rules.pl | 2 +- admin/oai_set_mappings.pl | 2 +- admin/oai_sets.pl | 2 +- admin/patron-attr-types.pl | 2 +- admin/preferences.pl | 2 +- admin/printers.pl | 2 +- admin/roadtype.pl | 2 +- admin/smart-rules.pl | 2 +- admin/stopwords.pl | 2 +- admin/systempreferences.pl | 2 +- admin/z3950servers.pl | 2 +- .../data/mysql/de-DE/mandatory/userpermissions.sql | 2 ++ .../data/mysql/en/mandatory/userpermissions.sql | 2 ++ .../data/mysql/es-ES/mandatory/userpermissions.sql | 2 ++ .../mysql/fr-FR/1-Obligatoire/userpermissions.sql | 2 ++ .../data/mysql/it-IT/necessari/userpermissions.sql | 2 ++ .../mysql/nb-NO/1-Obligatorisk/userpermissions.sql | 2 ++ .../data/mysql/pl-PL/mandatory/userpermissions.sql | 2 ++ .../ru-RU/mandatory/permissions_and_user_flags.sql | 2 ++ .../uk-UA/mandatory/permissions_and_user_flags.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 18 ++++++++++++++++++ .../prog/en/modules/admin/admin-home.tt | 2 ++ 42 files changed, 69 insertions(+), 31 deletions(-) diff --git a/admin/admin-home.pl b/admin/admin-home.pl index ad7a897..2d60b0a 100755 --- a/admin/admin-home.pl +++ b/admin/admin-home.pl @@ -30,7 +30,7 @@ my ($template, $loggedinuser, $cookie) query => $query, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => '*'}, debug => 1, }); diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl index 432d496..537f0ea 100755 --- a/admin/auth_subfields_structure.pl +++ b/admin/auth_subfields_structure.pl @@ -57,7 +57,7 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl index bd3dc93..587b27f 100755 --- a/admin/auth_tag_structure.pl +++ b/admin/auth_tag_structure.pl @@ -50,7 +50,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index 1545f0e..949e488 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -55,7 +55,7 @@ our $dbh = C4::Context->dbh; our ($template, $borrowernumber, $cookie)= get_template_and_user({ template_name => "admin/authorised_values.tmpl", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, query => $input, type => "intranet", debug => 1, diff --git a/admin/authtypes.pl b/admin/authtypes.pl index 250a89c..9869372 100755 --- a/admin/authtypes.pl +++ b/admin/authtypes.pl @@ -45,7 +45,7 @@ my ($template, $borrowernumber, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index f2c147e..e2130cf 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -47,7 +47,7 @@ my ($template, $borrowernumber, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/branches.pl b/admin/branches.pl index c12762d..d172ea6 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -63,7 +63,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1}, + flagsrequired => { parameters => 'parameters_remaining_permissions'}, debug => 1, } ); diff --git a/admin/categorie.pl b/admin/categorie.pl index 521346b..51e736a 100755 --- a/admin/categorie.pl +++ b/admin/categorie.pl @@ -73,7 +73,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/checkmarc.pl b/admin/checkmarc.pl index e08796f..8523b02 100755 --- a/admin/checkmarc.pl +++ b/admin/checkmarc.pl @@ -34,7 +34,7 @@ my ($template, $borrowernumber, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/cities.pl b/admin/cities.pl index 0303a48..378ceda 100755 --- a/admin/cities.pl +++ b/admin/cities.pl @@ -41,7 +41,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/classsources.pl b/admin/classsources.pl index 45183cd..e7f6c9a 100755 --- a/admin/classsources.pl +++ b/admin/classsources.pl @@ -40,7 +40,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/clone-rules.pl b/admin/clone-rules.pl index dcf4abe..c9e4665 100755 --- a/admin/clone-rules.pl +++ b/admin/clone-rules.pl @@ -43,7 +43,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/currency.pl b/admin/currency.pl index e24f6b6..aa878fd 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -57,7 +57,7 @@ our ($template, $loggedinuser, $cookie) = get_template_and_user({ template_name => 'admin/currency.tmpl', query => $input, type => 'intranet', - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, authnotrequired => 0, }); diff --git a/admin/env_tz_test.pl b/admin/env_tz_test.pl index 5bd5cd7..876e546 100755 --- a/admin/env_tz_test.pl +++ b/admin/env_tz_test.pl @@ -14,7 +14,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ query => $q, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/fieldmapping.pl b/admin/fieldmapping.pl index f7eca3c..2856e70 100755 --- a/admin/fieldmapping.pl +++ b/admin/fieldmapping.pl @@ -39,7 +39,7 @@ my ($template, $loggedinuser, $cookie) query => $query, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/item_circulation_alerts.pl b/admin/item_circulation_alerts.pl index ee77ae8..2bfb496 100755 --- a/admin/item_circulation_alerts.pl +++ b/admin/item_circulation_alerts.pl @@ -65,7 +65,7 @@ sub show { query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => defined($input->param('debug')), } ); diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 3219da3..841672d 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -77,7 +77,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl index a89681d..fc320ad 100755 --- a/admin/koha2marclinks.pl +++ b/admin/koha2marclinks.pl @@ -39,7 +39,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index bc6636a..365a861 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -72,7 +72,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index a86d788..2d7d913 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -52,7 +52,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/matching-rules.pl b/admin/matching-rules.pl index b167026..2fa2ac6 100755 --- a/admin/matching-rules.pl +++ b/admin/matching-rules.pl @@ -39,7 +39,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/oai_set_mappings.pl b/admin/oai_set_mappings.pl index 4d570f9..1a9762c 100755 --- a/admin/oai_set_mappings.pl +++ b/admin/oai_set_mappings.pl @@ -45,7 +45,7 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { query => $input, type => 'intranet', authnotrequired => 0, - flagsrequired => { 'parameters' => '*' }, + flagsrequired => { 'parameters' => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/oai_sets.pl b/admin/oai_sets.pl index a826107..c923e87 100755 --- a/admin/oai_sets.pl +++ b/admin/oai_sets.pl @@ -41,7 +41,7 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { query => $input, type => 'intranet', authnotrequired => 0, - flagsrequired => { 'parameters' => '*' }, + flagsrequired => { 'parameters' => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index 638456e..c0ad1f7 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -42,7 +42,7 @@ our ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/preferences.pl b/admin/preferences.pl index 0dcec19..b1ad005 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -261,7 +261,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/printers.pl b/admin/printers.pl index c32b4e6..79c9949 100755 --- a/admin/printers.pl +++ b/admin/printers.pl @@ -72,7 +72,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/roadtype.pl b/admin/roadtype.pl index a756594..a75c0dc 100755 --- a/admin/roadtype.pl +++ b/admin/roadtype.pl @@ -43,7 +43,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 8e5a2d5..cb35214 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -38,7 +38,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'manage_circ_rules'}, debug => 1, }); diff --git a/admin/stopwords.pl b/admin/stopwords.pl index 7a24af7..a64745f 100755 --- a/admin/stopwords.pl +++ b/admin/stopwords.pl @@ -48,7 +48,7 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "admin/stopwords.tmpl", query => $input, type => "intranet", - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, authnotrequired => 0, debug => 1, }); diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 5e3848d..078f5e8 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -592,7 +592,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl index 3bc0ef2..8d5ebdc 100755 --- a/admin/z3950servers.pl +++ b/admin/z3950servers.pl @@ -75,7 +75,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); diff --git a/installer/data/mysql/de-DE/mandatory/userpermissions.sql b/installer/data/mysql/de-DE/mandatory/userpermissions.sql index 254e090..31bfc51 100644 --- a/installer/data/mysql/de-DE/mandatory/userpermissions.sql +++ b/installer/data/mysql/de-DE/mandatory/userpermissions.sql @@ -1,6 +1,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', '?brige Ausleihberechtigungen'), ( 1, 'override_renewals', 'Gesperrte Verl?ngerungen ?berschreiben'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Vormerkungen f?r Benutzer setzen'), ( 6, 'modify_holds_priority', 'Vormerkungspriorit?t ver?ndern'), ( 9, 'edit_catalogue', 'Katalogdaten bearbeiten (Titel- und Exemplardaten ?ndern)'), diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql index da61f69..e6845e8 100644 --- a/installer/data/mysql/en/mandatory/userpermissions.sql +++ b/installer/data/mysql/en/mandatory/userpermissions.sql @@ -1,6 +1,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), diff --git a/installer/data/mysql/es-ES/mandatory/userpermissions.sql b/installer/data/mysql/es-ES/mandatory/userpermissions.sql index da61f69..e6845e8 100644 --- a/installer/data/mysql/es-ES/mandatory/userpermissions.sql +++ b/installer/data/mysql/es-ES/mandatory/userpermissions.sql @@ -1,6 +1,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql index 7a30f82..af84897 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql @@ -1,6 +1,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Fonctions de circulation restantes'), ( 1, 'override_renewals', 'Outrepasser les limites de renouvellement'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'R?server pour des adh?rents'), ( 6, 'modify_holds_priority', 'Modifier la priorit? des r?servations'), ( 9, 'edit_catalogue', 'Ajouter et modifier des notices au catalogue'), diff --git a/installer/data/mysql/it-IT/necessari/userpermissions.sql b/installer/data/mysql/it-IT/necessari/userpermissions.sql index 0e12644..99929be 100644 --- a/installer/data/mysql/it-IT/necessari/userpermissions.sql +++ b/installer/data/mysql/it-IT/necessari/userpermissions.sql @@ -3,6 +3,8 @@ SET FOREIGN_KEY_CHECKS=0; INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Permessi rimanenti per la circolazione'), ( 1, 'override_renewals', 'Sblocca i rinnovi bloccati'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Fai prenotazioni per gli utenti'), ( 6, 'modify_holds_priority', 'Modifica priorit? prenotazioni'), ( 9, 'edit_catalogue', 'Cataloga (crea/modifica dati bibliografici e di copia)'), diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql index f10af31..c43ddc9 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql @@ -22,6 +22,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', '?vrige rettigheter for sirkulasjon'), ( 1, 'override_renewals', 'Overstyre blokkerte fornyinger'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Foreta reservering for l?nere'), ( 6, 'modify_holds_priority', 'Endre rekkef?lge p? reserveringer'), ( 9, 'edit_catalogue', 'Endre katalogen (Endre bibliografiske poster og eksemplaropplysninger)'), diff --git a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql index a46ddfe..f123edd 100644 --- a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql +++ b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql @@ -1,6 +1,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), ( 9, 'edit_catalogue', 'Edit catalogue'), diff --git a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql b/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql index d948863..c2af6e8 100644 --- a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql +++ b/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql @@ -25,6 +25,8 @@ TRUNCATE permissions; INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), diff --git a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql b/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql index 53368b6..5dad109 100644 --- a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql +++ b/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql @@ -25,6 +25,8 @@ TRUNCATE permissions; INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), ( 1, 'override_renewals', 'Override blocked renewals'), + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 38aa70c..b611f88 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5246,6 +5246,24 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } + + + +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES + ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), + ( 3, 'manage_circ_rules', 'manage circulation rules')"); + $dbh->do("INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'parameters_remaining_permissions' + FROM borrowers WHERE flags & (1 << 3)"); + $dbh->do("INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_circ_rules' + FROM borrowers WHERE flags & (1 << 3)"); + print "Upgrade to $DBversion done (Added parameters subpermissions)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index ef46ede..1d08028 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -49,8 +49,10 @@
    Define road types (street, avenue, way, etc.). Road types display as authorized values when adding/editing patrons and can be used in geographic statistics.
    Patron attribute types
    Define extended attributes (identifiers and statistical categories) for patron records
    +[% IF CAN_user_parameters_manage_circ_rules %]
    Circulation and fines rules
    Define circulation and fines rules for combinations of libraries, patron categories, and item types
    +[% END %]
    Library transfer limits
    Limit the ability to transfer items between libraries based on the library sending, the library receiving, and the item type involved. These rules only go into effect if the preference UseBranchTransferLimits is set to ON.
    Item circulation alerts
    -- 1.7.9.5 From colin.campbell at ptfs-europe.com Tue May 22 12:32:12 2012 From: colin.campbell at ptfs-europe.com (Colin Campbell) Date: Tue, 22 May 2012 11:32:12 +0100 Subject: [Koha-patches] [PATCH] Bug 8125 Sip addess should include all address fields Message-ID: <1337682732-23911-1-git-send-email-colin.campbell@ptfs-europe.com> Expansion of Liz Rea's original patch Bug report specifically mentioned kack of the Zip/Postal code but all used address fields should be included. Moved the address generation to its own sub. Hopefully using an if else will read more clearly than the original ternary operator proved to be --- C4/SIP/ILS/Patron.pm | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 99fd6e7..38b7da3 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -59,13 +59,11 @@ sub new { $kp->{opacnote} .= 'PATRON EXPIRED'; } my %ilspatron; - my $adr = $kp->{streetnumber} || ''; - my $address = $kp->{address} || ''; + my $adr = _get_address($kp); my $dob = $kp->{dateofbirth}; $dob and $dob =~ s/-//g; # YYYYMMDD my $dexpiry = $kp->{dateexpiry}; $dexpiry and $dexpiry =~ s/-//g; # YYYYMMDD - $adr .= ($adr && $address) ? " $address" : $address; my $fines_amount = $flags->{CHARGES}->{amount}; $fines_amount = ($fines_amount and $fines_amount > 0) ? $fines_amount : 0; { @@ -350,6 +348,24 @@ sub charge_denied { return "Please contact library staff"; } +sub _get_address { + my $patron = shift; + + my $address = $patron->{streetnumber} || q{}; + for my $field (qw( roaddetails address address2 city state zipcode country)) + { + next unless $patron->{$field}; + if ($address) { + $address .= q{ }; + $address .= $patron->{$field}; + } + else { + $address .= $patron->{$field}; + } + } + return $address; +} + 1; __END__ -- 1.7.7.6 From amit.gupta at osslabs.biz Tue May 22 12:39:46 2012 From: amit.gupta at osslabs.biz (Amit Gupta) Date: Tue, 22 May 2012 16:09:46 +0530 Subject: [Koha-patches] [PATCH] Bug 5795 Update the database as follow-up If sys pref Message-ID: <1337683186-17030-1-git-send-email-amit.gupta@osslabs.biz> ReservesControlBranch has null then update the table to insert a PatronLibrary as value To Test: 1) Go to mysql use koha database 2) select * from systempreferences where variable = 'ReservesControlBranch'; Check if value set to ItemHomeLibrary. +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ | variable | value | options | explanation | type | +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ | ReservesControlBranch | PatronLibrary | ItemHomeLibrary|PatronLibrary | Branch checked for members reservations rights. | Choice | +-----------------------+-----------------+-------------------------------+-------------------------------------------------+--------+ --- installer/data/mysql/updatedatabase.pl | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 38aa70c..33e26e3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5246,6 +5246,15 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + unless(C4::Context->preference('ReservesControlBranch')){ + $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights.','Choice')"); +} + print "Upgrade to $DBversion done (Insert ReservesControlBranch systempreference into systempreferences table )\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.6.4.2 From christophe.croullebois at biblibre.com Tue May 22 14:11:04 2012 From: christophe.croullebois at biblibre.com (christophe croullebois) Date: Tue, 22 May 2012 14:11:04 +0200 Subject: [Koha-patches] [PATCH 1/1] Bug 8136 Changes the expected lenght of 100$a in rebuild_zebra.pl Message-ID: <1337688664-13012-1-git-send-email-christophe.croullebois@biblibre.com> In rebuild_zebra.pl, if we are in "unimarc" ("marcflavour" syspref), the sub "fix_unimarc_100" is called and checks if 100$a lenght is equal to 35. If it is not the case, the sub inserts the localtime and more, so we loose the datas in reindexing. The standart lenght is 36. I have just changed 35 to 36. --- misc/migration_tools/rebuild_zebra.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 655b6d4..f765d00 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -562,7 +562,7 @@ sub fix_unimarc_100 { my $marc = shift; my $string; - if ( length($marc->subfield( 100, "a" )) == 35 ) { + if ( length($marc->subfield( 100, "a" )) == 36 ) { $string = $marc->subfield( 100, "a" ); my $f100 = $marc->field(100); $marc->delete_field($f100); @@ -573,7 +573,7 @@ sub fix_unimarc_100 { $string = sprintf( "%-*s", 35, $string ); } substr( $string, 22, 6, "frey50" ); - unless ( length($marc->subfield( 100, "a" )) == 35 ) { + unless ( length($marc->subfield( 100, "a" )) == 36 ) { $marc->delete_field($marc->field(100)); $marc->insert_grouped_field(MARC::Field->new( 100, "", "", "a" => $string )); } -- 1.7.9.5 From srdjan at catalyst.net.nz Wed May 23 03:06:31 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Wed, 23 May 2012 13:06:31 +1200 Subject: [Koha-patches] [PATCH] bug_7398: Replaced OPACDisplayRequestPriority syspref with OPACShowHoldQueueDetails In-Reply-To: References: Message-ID: <1337735191-9174-1-git-send-email-srdjan@catalyst.net.nz> New syspref is Choice, options being: - None - Priority only - Holds number only - Holds number and priority Show holds count on OPAC detail --- admin/systempreferences.pl | 2 +- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 15 +++++ .../prog/en/modules/admin/preferences/opac.pref | 10 ++-- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 31 ++++++++++ .../opac-tmpl/prog/en/modules/opac-reserve.tt | 34 ++++++----- opac/opac-detail.pl | 24 ++++++++ opac/opac-reserve.pl | 60 +++++++++++--------- opac/opac-user.pl | 11 ++-- 9 files changed, 139 insertions(+), 50 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 5e3848d..3659791 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -348,7 +348,7 @@ $tabsysprefs{OPACViewOthersSuggestions} = "OPAC"; $tabsysprefs{URLLinkText} = "OPAC"; $tabsysprefs{OPACSearchForTitleIn} = "OPAC"; $tabsysprefs{OPACShelfBrowser} = "OPAC"; -$tabsysprefs{OPACDisplayRequestPriority} = "OPAC"; +$tabsysprefs{OPACShowHoldQueueDetails} = "OPAC"; $tabsysprefs{OPACAllowHoldDateInFuture} = "OPAC"; $tabsysprefs{OPACPatronDetails} = "OPAC"; $tabsysprefs{OPACFinesTab} = "OPAC"; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1edf08e..98e0e76 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -233,7 +233,7 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AcqCreateItem','ordering','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo'); -INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('OPACDisplayRequestPriority','0','','Show patrons the priority level on holds in the OPAC','YesNo'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('OPACShowHoldQueueDetails','none','none|priority|holds|holds_priority','Show holds details in OPAC','Choice'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'UseBranchTransferLimits', '0', '', 'If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldPolicyOverride', '0', 'Allow staff to override hold policies when placing holds',NULL,'YesNo'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'BranchTransferLimitsType', 'ccode', 'itemtype|ccode', 'When using branch transfer limits, choose whether to limit by itemtype or collection code.', 'Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 38aa70c..d5f1144 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5246,6 +5246,21 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } + + +$DBversion = "3.07.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("UPDATE systempreferences SET + variable = 'OPACShowHoldQueueDetails', + value = CASE value WHEN '1' THEN 'priority' ELSE 'none' END, + options = 'none|priority|holds|holds_priority', + explanation = 'Show holds details in OPAC', + type = 'Choice' + WHERE variable = 'OPACDisplayRequestPriority'"); + print "Upgrade to $DBversion done (Changed system preference OPACDisplayRequestPriority -> OPACShowHoldQueueDetails)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index eb74d81..3bd2441 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -79,11 +79,13 @@ OPAC: no: "Don't include" - "COinS / OpenURL / Z39.88 in OPAC search results.
    Warning: Enabling this feature will slow OPAC search response times." - - - pref: OPACDisplayRequestPriority + - pref: OPACShowHoldQueueDetails choices: - yes: Show - no: "Don't show" - - patrons the priority level of their holds in the OPAC. + none: "Don't show any hold details" + priority: "Show priority level" + holds: "Show holds" + holds_priority: "Show holds and their priority level" + - to patrons in the OPAC. - - pref: OPACShowCheckoutName default: 0 diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index cc59fb2..5bbcdb7 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -718,6 +718,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () { Status [% IF ( itemdata_itemnotes ) %]Notes[% END %] Date due + [% IF holds_count.defined %] + Item holds + [% ELSIF show_priority %] + Item hold queue priority + [% END %] [% FOREACH ITEM_RESULT IN ITEM_RESULTS %] [% IF ( item_level_itypes ) %][% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %][% END %] @@ -742,10 +747,36 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] [% ITEM_RESULT.datedue | $KohaDates %] + [% IF holds_count.defined || show_priority %] + + [% IF holds_count.defined %] [% ITEM_RESULT.holds_count %] [% END %] + [% IF ITEM_RESULT.priority %] + [% IF holds_count.defined %] + (priority [% ITEM_RESULT.priority %]) + [% ELSE %] + [% ITEM_RESULT.priority %] + [% END %] + [% END %] + + [% END %] [% END %] [% END %] + [% IF holds_count.defined || priority %] +
    + [% IF holds_count.defined %] + Total holds: [% holds_count %] + [% END %] + [% IF priority %] + [% IF holds_count.defined %] + (priority [% priority %]) + [% ELSE %] + Overall queue priority: [% priority %] + [% END %] + [% END %] +
    + [% END %] [% ELSE %] [% IF ( ALTERNATEHOLDINGS ) %] [% FOREACH ALTERNATEHOLDING IN ALTERNATEHOLDINGS %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index a78bc68..2073811 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -242,7 +242,11 @@ [% UNLESS ( item_level_itypes ) %] Item type [% END %] - [% IF ( showpriority ) %] + [% IF showholds && showpriority %] + Holds and priority + [% ELSIF showholds %] + Holds + [% ELSIF showpriority %] Priority [% END %] [% IF ( reserve_in_future ) %] @@ -297,19 +301,23 @@ [% END %] - [% IF ( bibitemloo.holdable ) %][% UNLESS ( item_level_itypes ) %] - - [% IF ( bibitemloo.imageurl ) %][% END %] - [% bibitemloo.description %] - - [% END %][% END %] [% IF ( bibitemloo.holdable ) %] - [% IF ( showpriority ) %] - - [% bibitemloo.rank %] out of [% bibitemloo.reservecount %] - [% END %][% END %] - [% IF ( reserve_in_future ) %] - [% IF ( bibitemloo.holdable ) %] + + [% UNLESS ( item_level_itypes ) %] + + [% IF ( bibitemloo.imageurl ) %][% END %] + [% bibitemloo.description %] + + [% END %] + [% IF showholds || showpriority %] + + [% IF showpriority %] [% bibitemloo.rank %] [% END %] + [% IF showholds && showpriority %] out of [% END %] + [% IF showholds %] [% bibitemloo.reservecount %] [% END %] + + [% END %] + [% IF ( reserve_in_future ) %] + + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
    + +
    +
    +
    +

    + Defining transport costs between libraries +

    +[% IF ( WARNING_transport_cost_matrix_off ) %] +
    Because the "UseTransportCostMatrix" system preference is currently not enabled, Transport Cost Matrix is not being used. Go here if you wish to enable this feature.
    +[% END %] + +
    +
    + +
    +
    +

    Costs are decimal values 0 to some arbitrarymax value (1 or 100), 0 being minimum (no) cost.

    +

    Red cells signify no transfer allowed

    +

    Click on the cell to edit

    +
    +
      + [% FOR e IN errors %] +
    • [% e %]
    • + [% END %] +
    + + + + [% FOR b IN branchloop %] + + [% END %] + + [% FOR bf IN branchfromloop %] + + + [% FOR bt IN bf.branchtoloop %] + + [% END %] + + [% END %] +
    From \ To[% b.name %]
    [% bf.name %] + [% IF bt.skip %] +   + [% ELSE %] +
    +
    [% !bt.disabled && bt.value > '' ? bt.value : ' ' %]
    + + [% IF bt.disabled %] + + [% END %] +
    + [% END %] +
    +
    + +
    +
    +
    +
    +
    +[% INCLUDE 'admin-menu.inc' %] +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/misc/cronjobs/holds/build_holds_queue.pl b/misc/cronjobs/holds/build_holds_queue.pl index f01153e..9ec9825 100755 --- a/misc/cronjobs/holds/build_holds_queue.pl +++ b/misc/cronjobs/holds/build_holds_queue.pl @@ -5,7 +5,6 @@ #----------------------------------- # FIXME: add command-line options for verbosity and summary # FIXME: expand perldoc, explain intended logic -# FIXME: refactor all subroutines into C4 for testability use strict; use warnings; @@ -16,384 +15,7 @@ BEGIN { eval { require "$FindBin::Bin/../kohalib.pl" }; } -use C4::Context; -use C4::Search; -use C4::Items; -use C4::Branch; -use C4::Circulation; -use C4::Members; -use C4::Biblio; +use C4::HoldsQueue qw(CreateQueue); -use List::Util qw(shuffle); +CreateQueue(); -my $bibs_with_pending_requests = GetBibsWithPendingHoldRequests(); - -my $dbh = C4::Context->dbh; -$dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info -$dbh->do("DELETE FROM hold_fill_targets"); - -my $total_bibs = 0; -my $total_requests = 0; -my $total_available_items = 0; -my $num_items_mapped = 0; - -my @branches_to_use = _get_branches_to_pull_from(); - -foreach my $biblionumber (@$bibs_with_pending_requests) { - $total_bibs++; - my $hold_requests = GetPendingHoldRequestsForBib($biblionumber); - my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber, @branches_to_use); - $total_requests += scalar(@$hold_requests); - $total_available_items += scalar(@$available_items); - my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, @branches_to_use); - - (defined($item_map)) or next; - - my $item_map_size = scalar(keys %$item_map); - $num_items_mapped += $item_map_size; - CreatePicklistFromItemMap($item_map); - AddToHoldTargetMap($item_map); - if (($item_map_size < scalar(@$hold_requests )) and - ($item_map_size < scalar(@$available_items))) { - # DOUBLE CHECK, but this is probably OK - unfilled item-level requests - # FIXME - #warn "unfilled requests for $biblionumber"; - #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map); - } -} - -exit 0; - -=head1 FUNCTIONS - -=head2 GetBibsWithPendingHoldRequests - - my $biblionumber_aref = GetBibsWithPendingHoldRequests(); - -Return an arrayref of the biblionumbers of all bibs -that have one or more unfilled hold requests. - -=cut - -sub GetBibsWithPendingHoldRequests { - my $dbh = C4::Context->dbh; - - my $bib_query = "SELECT DISTINCT biblionumber - FROM reserves - WHERE found IS NULL - AND priority > 0 - AND reservedate <= CURRENT_DATE()"; - my $sth = $dbh->prepare($bib_query); - - $sth->execute(); - my $biblionumbers = $sth->fetchall_arrayref(); - - return [ map { $_->[0] } @$biblionumbers ]; -} - -=head2 GetPendingHoldRequestsForBib - - my $requests = GetPendingHoldRequestsForBib($biblionumber); - -Returns an arrayref of hashrefs to pending, unfilled hold requests -on the bib identified by $biblionumber. The following keys -are present in each hashref: - - biblionumber - borrowernumber - itemnumber - priority - branchcode - reservedate - reservenotes - borrowerbranch - -The arrayref is sorted in order of increasing priority. - -=cut - -sub GetPendingHoldRequestsForBib { - my $biblionumber = shift; - - my $dbh = C4::Context->dbh; - - my $request_query = "SELECT biblionumber, borrowernumber, itemnumber, priority, reserves.branchcode, - reservedate, reservenotes, borrowers.branchcode AS borrowerbranch - FROM reserves - JOIN borrowers USING (borrowernumber) - WHERE biblionumber = ? - AND found IS NULL - AND priority > 0 - AND reservedate <= CURRENT_DATE() - ORDER BY priority"; - my $sth = $dbh->prepare($request_query); - $sth->execute($biblionumber); - - my $requests = $sth->fetchall_arrayref({}); - return $requests; - -} - -=head2 GetItemsAvailableToFillHoldRequestsForBib - - my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber); - -Returns an arrayref of items available to fill hold requests -for the bib identified by C<$biblionumber>. An item is available -to fill a hold request if and only if: - - * it is not on loan - * it is not withdrawn - * it is not marked notforloan - * it is not currently in transit - * it is not lost - * it is not sitting on the hold shelf - -=cut - -sub GetItemsAvailableToFillHoldRequestsForBib { - my $biblionumber = shift; - my @branches_to_use = @_; - - my $dbh = C4::Context->dbh; - my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype - FROM items "; - - if (C4::Context->preference('item-level_itypes')) { - $items_query .= "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) "; - } else { - $items_query .= "JOIN biblioitems USING (biblioitemnumber) - LEFT JOIN itemtypes USING (itemtype) "; - } - $items_query .= "WHERE items.notforloan = 0 - AND holdingbranch IS NOT NULL - AND itemlost = 0 - AND wthdrawn = 0"; - $items_query .= " AND damaged = 0 " unless C4::Context->preference('AllowHoldsOnDamagedItems'); - $items_query .= " AND items.onloan IS NULL - AND (itemtypes.notforloan IS NULL OR itemtypes.notforloan = 0) - AND itemnumber NOT IN ( - SELECT itemnumber - FROM reserves - WHERE biblionumber = ? - AND itemnumber IS NOT NULL - AND (found IS NOT NULL OR priority = 0) - ) - AND items.biblionumber = ?"; - my @params = ($biblionumber, $biblionumber); - if ($#branches_to_use > -1) { - $items_query .= " AND holdingbranch IN (" . join (",", map { "?" } @branches_to_use) . ")"; - push @params, @branches_to_use; - } - my $sth = $dbh->prepare($items_query); - $sth->execute(@params); - - my $items = $sth->fetchall_arrayref({}); - $items = [ grep { my @transfers = GetTransfers($_->{itemnumber}); $#transfers == -1; } @$items ]; - map { my $rule = GetBranchItemRule($_->{homebranch}, $_->{itype}); $_->{holdallowed} = $rule->{holdallowed}; $rule->{holdallowed} != 0 } @$items; - return [ grep { $_->{holdallowed} != 0 } @$items ]; -} - -=head2 MapItemsToHoldRequests - - MapItemsToHoldRequests($hold_requests, $available_items); - -=cut - -sub MapItemsToHoldRequests { - my $hold_requests = shift; - my $available_items = shift; - my @branches_to_use = @_; - - # handle trival cases - return unless scalar(@$hold_requests) > 0; - return unless scalar(@$available_items) > 0; - - # identify item-level requests - my %specific_items_requested = map { $_->{itemnumber} => 1 } - grep { defined($_->{itemnumber}) } - @$hold_requests; - - # group available items by itemnumber - my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items; - - # items already allocated - my %allocated_items = (); - - # map of items to hold requests - my %item_map = (); - - # figure out which item-level requests can be filled - my $num_items_remaining = scalar(@$available_items); - foreach my $request (@$hold_requests) { - last if $num_items_remaining == 0; - - # is this an item-level request? - if (defined($request->{itemnumber})) { - # fill it if possible; if not skip it - if (exists $items_by_itemnumber{$request->{itemnumber}} and - not exists $allocated_items{$request->{itemnumber}}) { - $item_map{$request->{itemnumber}} = { - borrowernumber => $request->{borrowernumber}, - biblionumber => $request->{biblionumber}, - holdingbranch => $items_by_itemnumber{$request->{itemnumber}}->{holdingbranch}, - pickup_branch => $request->{branchcode}, - item_level => 1, - reservedate => $request->{reservedate}, - reservenotes => $request->{reservenotes}, - }; - $allocated_items{$request->{itemnumber}}++; - $num_items_remaining--; - } - } else { - # it's title-level request that will take up one item - $num_items_remaining--; - } - } - - # group available items by branch - my %items_by_branch = (); - foreach my $item (@$available_items) { - push @{ $items_by_branch{ $item->{holdingbranch} } }, $item unless exists $allocated_items{ $item->{itemnumber} }; - } - - # now handle the title-level requests - $num_items_remaining = scalar(@$available_items) - scalar(keys %allocated_items); - foreach my $request (@$hold_requests) { - last if $num_items_remaining <= 0; - next if defined($request->{itemnumber}); # already handled these - - # look for local match first - my $pickup_branch = $request->{branchcode}; - if (exists $items_by_branch{$pickup_branch} and - not ($items_by_branch{$pickup_branch}->[0]->{holdallowed} == 1 and - $request->{borrowerbranch} ne $items_by_branch{$pickup_branch}->[0]->{homebranch}) - ) { - my $item = pop @{ $items_by_branch{$pickup_branch} }; - delete $items_by_branch{$pickup_branch} if scalar(@{ $items_by_branch{$pickup_branch} }) == 0; - $item_map{$item->{itemnumber}} = { - borrowernumber => $request->{borrowernumber}, - biblionumber => $request->{biblionumber}, - holdingbranch => $pickup_branch, - pickup_branch => $pickup_branch, - item_level => 0, - reservedate => $request->{reservedate}, - reservenotes => $request->{reservenotes}, - }; - $num_items_remaining--; - } else { - my @pull_branches = (); - if ($#branches_to_use > -1) { - @pull_branches = @branches_to_use; - } else { - @pull_branches = sort keys %items_by_branch; - } - foreach my $branch (@pull_branches) { - next unless exists $items_by_branch{$branch} and - not ($items_by_branch{$branch}->[0]->{holdallowed} == 1 and - $request->{borrowerbranch} ne $items_by_branch{$branch}->[0]->{homebranch}); - my $item = pop @{ $items_by_branch{$branch} }; - delete $items_by_branch{$branch} if scalar(@{ $items_by_branch{$branch} }) == 0; - $item_map{$item->{itemnumber}} = { - borrowernumber => $request->{borrowernumber}, - biblionumber => $request->{biblionumber}, - holdingbranch => $branch, - pickup_branch => $pickup_branch, - item_level => 0, - reservedate => $request->{reservedate}, - reservenotes => $request->{reservenotes}, - }; - $num_items_remaining--; - last; - } - } - } - return \%item_map; -} - -=head2 CreatePickListFromItemMap - -=cut - -sub CreatePicklistFromItemMap { - my $item_map = shift; - - my $dbh = C4::Context->dbh; - - my $sth_load=$dbh->prepare(" - INSERT INTO tmp_holdsqueue (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber, - cardnumber,reservedate,title, itemcallnumber, - holdingbranch,pickbranch,notes, item_level_request) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) - "); - - foreach my $itemnumber (sort keys %$item_map) { - my $mapped_item = $item_map->{$itemnumber}; - my $biblionumber = $mapped_item->{biblionumber}; - my $borrowernumber = $mapped_item->{borrowernumber}; - my $pickbranch = $mapped_item->{pickup_branch}; - my $holdingbranch = $mapped_item->{holdingbranch}; - my $reservedate = $mapped_item->{reservedate}; - my $reservenotes = $mapped_item->{reservenotes}; - my $item_level = $mapped_item->{item_level}; - - my $item = GetItem($itemnumber); - my $barcode = $item->{barcode}; - my $itemcallnumber = $item->{itemcallnumber}; - - my $borrower = GetMember('borrowernumber'=>$borrowernumber); - my $cardnumber = $borrower->{'cardnumber'}; - my $surname = $borrower->{'surname'}; - my $firstname = $borrower->{'firstname'}; - my $phone = $borrower->{'phone'}; - - my $bib = GetBiblioData($biblionumber); - my $title = $bib->{title}; - - $sth_load->execute($biblionumber, $itemnumber, $barcode, $surname, $firstname, $phone, $borrowernumber, - $cardnumber, $reservedate, $title, $itemcallnumber, - $holdingbranch, $pickbranch, $reservenotes, $item_level); - } -} - -=head2 AddToHoldTargetMap - -=cut - -sub AddToHoldTargetMap { - my $item_map = shift; - - my $dbh = C4::Context->dbh; - - my $insert_sql = q( - INSERT INTO hold_fill_targets (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request) - VALUES (?, ?, ?, ?, ?) - ); - my $sth_insert = $dbh->prepare($insert_sql); - - foreach my $itemnumber (keys %$item_map) { - my $mapped_item = $item_map->{$itemnumber}; - $sth_insert->execute($mapped_item->{borrowernumber}, $mapped_item->{biblionumber}, $itemnumber, - $mapped_item->{holdingbranch}, $mapped_item->{item_level}); - } -} - -=head2 _get_branches_to_pull_from - -Query system preferences to get ordered list of -branches to use to fill hold requests. - -=cut - -sub _get_branches_to_pull_from { - my @branches_to_use = (); - - my $static_branch_list = C4::Context->preference("StaticHoldsQueueWeight"); - if ($static_branch_list) { - @branches_to_use = map { s/^\s+//; s/\s+$//; $_; } split /,/, $static_branch_list; - } - - @branches_to_use = shuffle(@branches_to_use) if C4::Context->preference("RandomizeHoldsQueueWeight"); - - return @branches_to_use; -} diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t new file mode 100755 index 0000000..7e882db --- /dev/null +++ b/t/db_dependent/HoldsQueue.t @@ -0,0 +1,175 @@ +#!/usr/bin/perl + +# Test C4::HoldsQueue::CreateQueue() for both transport cost matrix +# and StaticHoldsQueueWeight array (no RandomizeHoldsQueueWeight, no point) +# Wraps tests in transaction that's rolled back, so no data is destroyed +# MySQL WARNING: This makes sense only if your tables are InnoDB, otherwise +# transactions are not supported and mess is left behind + +use strict; +use warnings; +use C4::Context; + +use Data::Dumper; + +use Test::More tests => 18; + +BEGIN { + use FindBin; + use lib $FindBin::Bin; + use_ok('C4::Reserves'); + use_ok('C4::HoldsQueue'); +} + +my $TITLE = "Test Holds Queue XXX"; +# Pick a plausible borrower. Easier than creating one. +my $BORROWER_QRY = <dbh; +my $borrower = $dbh->selectrow_hashref($BORROWER_QRY); +my $borrowernumber = $borrower->{borrowernumber}; +# Set special (for this test) branches +my $borrower_branchcode = $borrower->{branchcode}; +my @other_branches = grep { $_ ne $borrower_branchcode } @{ $dbh->selectcol_arrayref("SELECT branchcode FROM branches") }; +my $least_cost_branch_code = pop @other_branches + or BAIL_OUT("No point testing only one branch..."); +my $itemtype = $dbh->selectrow_array("SELECT min(itemtype) FROM itemtypes WHERE notforloan = 0") + or BAIL_OUT("No adequate itemtype"); + +# Start transaction +$dbh->{AutoCommit} = 0; +$dbh->{RaiseError} = 1; + +#Set up the stage +# Sysprefs and cost matrix +$dbh->do("UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'", undef, + join( ',', @other_branches, $borrower_branchcode, $least_cost_branch_code)); +$dbh->do("UPDATE systempreferences SET value = '0' WHERE variable = 'RandomizeHoldsQueueWeight'"); + +$dbh->do("DELETE FROM transport_cost"); +my $transport_cost_insert_sth = $dbh->prepare("insert into transport_cost (frombranch, tobranch, cost) values (?, ?, ?)"); +# Favour $least_cost_branch_code +$transport_cost_insert_sth->execute($borrower_branchcode, $least_cost_branch_code, 0.2); +$transport_cost_insert_sth->execute($least_cost_branch_code, $borrower_branchcode, 0.2); +my @b = @other_branches; +while ( my $b1 = shift @b ) { + foreach my $b2 ($borrower_branchcode, $least_cost_branch_code, @b) { + $transport_cost_insert_sth->execute($b1, $b2, 0.5); + $transport_cost_insert_sth->execute($b2, $b1, 0.5); + } +} + + +# Loanable items - all possible combinations of homebranch and holdingbranch +$dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) + VALUES ('SER', 'Koha test', '$TITLE', '2011-02-01')"); +my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'") + or BAIL_OUT("Cannot find newly created biblio record"); +$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) + VALUES ($biblionumber, '', '$itemtype')"); +my $biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber") + or BAIL_OUT("Cannot find newly created biblioitems record"); + +my $items_insert_sth = $dbh->prepare("INSERT INTO items (biblionumber, biblioitemnumber, barcode, homebranch, holdingbranch, notforloan, damaged, itemlost, wthdrawn, onloan, itype) + VALUES ($biblionumber, $biblioitemnumber, ?, ?, ?, 0, 0, 0, 0, NULL, '$itemtype')"); # CURRENT_DATE - 3)"); +my $first_barcode = int(rand(1000000000000)); # XXX +my $barcode = $first_barcode; +foreach ( $borrower_branchcode, $least_cost_branch_code, @other_branches ) { + $items_insert_sth->execute($barcode++, $borrower_branchcode, $_); + $items_insert_sth->execute($barcode++, $_, $_); + $items_insert_sth->execute($barcode++, $_, $borrower_branchcode); +} + +# Remove existing reserves, makes debugging easier +$dbh->do("DELETE FROM reserves"); +my $constraint = undef; +my $bibitems = undef; +my $priority = 1; +# Make a reserve +AddReserve ( $borrower_branchcode, $borrowernumber, $biblionumber, $constraint, $bibitems, $priority ); +# $resdate, $expdate, $notes, $title, $checkitem, $found +$dbh->do("UPDATE reserves SET reservedate = reservedate - 1"); + +# Tests +my $use_cost_matrix_sth = $dbh->prepare("UPDATE systempreferences SET value = ? WHERE variable = 'UseTransportCostMatrix'"); +my $test_sth = $dbh->prepare("SELECT * FROM hold_fill_targets + JOIN tmp_holdsqueue USING (borrowernumber, biblionumber, itemnumber) + JOIN items USING (itemnumber) + WHERE borrowernumber = $borrowernumber"); + +# We have a book available homed in borrower branch, no point fiddling with AutomaticItemReturn +test_queue ('take from homebranch', 0, $borrower_branchcode, $borrower_branchcode); +test_queue ('take from homebranch', 1, $borrower_branchcode, $borrower_branchcode); + +$dbh->do("DELETE FROM tmp_holdsqueue"); +$dbh->do("DELETE FROM hold_fill_targets"); +$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE homebranch = '$borrower_branchcode' AND holdingbranch = '$borrower_branchcode')"); +$dbh->do("DELETE FROM items WHERE homebranch = '$borrower_branchcode' AND holdingbranch = '$borrower_branchcode'"); +# test_queue will flush +$dbh->do("UPDATE systempreferences SET value = 1 WHERE variable = 'AutomaticItemReturn'"); +# Not sure how to make this test more difficult - holding branch does not matter +test_queue ('take from holdingbranch AutomaticItemReturn on', 0, $borrower_branchcode, undef); +test_queue ('take from holdingbranch AutomaticItemReturn on', 1, $borrower_branchcode, $least_cost_branch_code); + +$dbh->do("DELETE FROM tmp_holdsqueue"); +$dbh->do("DELETE FROM hold_fill_targets"); +$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE homebranch = '$borrower_branchcode')"); +$dbh->do("DELETE FROM items WHERE homebranch = '$borrower_branchcode'"); +$dbh->do("UPDATE systempreferences SET value = 0 WHERE variable = 'AutomaticItemReturn'"); +# We have a book available held in borrower branch +test_queue ('take from holdingbranch', 0, $borrower_branchcode, $borrower_branchcode); +test_queue ('take from holdingbranch', 1, $borrower_branchcode, $borrower_branchcode); + +$dbh->do("DELETE FROM tmp_holdsqueue"); +$dbh->do("DELETE FROM hold_fill_targets"); +$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE holdingbranch = '$borrower_branchcode')"); +$dbh->do("DELETE FROM items WHERE holdingbranch = '$borrower_branchcode'"); +# No book available in borrower branch, pick according to the rules +# Frst branch from StaticHoldsQueueWeight +test_queue ('take from lowest cost branch', 0, $borrower_branchcode, $other_branches[0]); +test_queue ('take from lowest cost branch', 1, $borrower_branchcode, $least_cost_branch_code); +my $queue = C4::HoldsQueue::GetHoldsQueueItems($least_cost_branch_code) || []; +my $queue_item = $queue->[0]; +ok( $queue_item + && $queue_item->{pickbranch} eq $borrower_branchcode + && $queue_item->{holdingbranch} eq $least_cost_branch_code, "GetHoldsQueueItems" ) + or diag( "Expected item for pick $borrower_branchcode, hold $least_cost_branch_code, got ".Dumper($queue_item) ); + +# XXX All this tests are for borrower branch pick-up. +# Maybe needs expanding to homebranch or holdingbranch pick-up. + +# Cleanup +$dbh->rollback; + +exit; + +sub test_queue { + my ($test_name, $use_cost_matrix, $pick_branch, $hold_branch) = @_; + + $test_name = "$test_name (".($use_cost_matrix ? "" : "don't")." use cost matrix)"; + + $use_cost_matrix_sth->execute($use_cost_matrix); + C4::Context->_flush_preferences(); + C4::HoldsQueue::CreateQueue(); + + my $results = $dbh->selectall_arrayref($test_sth, { Slice => {} }); # should be only one + my $r = $results->[0]; + + my $ok = is( $r->{pickbranch}, $pick_branch, "$test_name pick up branch"); + $ok &&= is( $r->{holdingbranch}, $hold_branch, "$test_name holding branch") + if $hold_branch; + + diag( "Wrong pick-up/hold for first target (pick_branch, hold_branch, reserves, hold_fill_targets, tmp_holdsqueue): " + . Dumper ($pick_branch, $hold_branch, map dump_records($_), qw(reserves hold_fill_targets tmp_holdsqueue)) ) + unless $ok; +} + +sub dump_records { + my ($tablename) = @_; + return $dbh->selectall_arrayref("SELECT * from $tablename where borrowernumber = ?", { Slice => {} }, $borrowernumber); +} + + -- 1.7.9.5 From colin.campbell at ptfs-europe.com Thu May 24 18:16:57 2012 From: colin.campbell at ptfs-europe.com (Colin Campbell) Date: Thu, 24 May 2012 17:16:57 +0100 Subject: [Koha-patches] [PATCH] Bug 8150 Remove obsoleted navigation bar in circ history Message-ID: <1337876217-11731-1-git-send-email-colin.campbell@ptfs-europe.com> The navigation bar is now supplied by the datatables plugin however we are still calling the old navigation include resulting in a second navigation bar which does nor work --- .../prog/en/modules/members/readingrec.tt | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index f90d7a8..3b1f55a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -29,9 +29,6 @@ [% IF ( loop_reading ) %]
    -
    -[% INCLUDE 'table-pager.inc' perpage='20' %] -
    -- 1.7.7.6 From jcamins at cpbibliography.com Thu May 24 21:36:53 2012 From: jcamins at cpbibliography.com (Jared Camins-Esakov) Date: Thu, 24 May 2012 15:36:53 -0400 Subject: [Koha-patches] [PATCH 1/3] Bug 6557: Syspref to control total issue counting Message-ID: <1337888215-20111-1-git-send-email-jcamins@cpbibliography.com> Because updating the total issues count associated with a bibliographic record on issue could cause a significant load on the server, this commit adds the syspref UpdateTotalIssuesOnCirc (which defaults to OFF to match existing behavior). The syspref has the following description: Do/Do not update a bibliographic record's total issues count whenever an item is issued (WARNING! This increases server load significantly; if performance is a concern, use the update_totalissues.pl cron job to update the total issues count). --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/circulation.pref | 6 ++++++ 3 files changed, 14 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1edf08e..5edabdd 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -363,3 +363,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SvcMaxReportRows','10','Maximum number of rows to return via the report web service.',NULL,'Integer'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 38aa70c..ec323a0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5246,6 +5246,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');"); + print "Upgrade to $DBversion done (Add syspref UpdateTotalIssuesOnCirc)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 471aa0e..e790944 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -103,6 +103,12 @@ Circulation: - pref: NoticeCSS class: url - on Notices. (This should be a complete URL, starting with http://) + - + - pref: UpdateTotalIssuesOnCirc + choices: + yes: Do + no: "Do not" + - update a bibliographic record's total issues count whenever an item is issued (WARNING! This increases server load significantly; if performance is a concern, use the update_totalissues.pl cron job to update the total issues count). Checkout Policy: - - pref: AllowNotForLoanOverride -- 1.7.2.5 From jcamins at cpbibliography.com Thu May 24 21:36:54 2012 From: jcamins at cpbibliography.com (Jared Camins-Esakov) Date: Thu, 24 May 2012 15:36:54 -0400 Subject: [Koha-patches] [PATCH 2/3] Bug 6557: automatically increment totalissues In-Reply-To: <1337888215-20111-1-git-send-email-jcamins@cpbibliography.com> References: <1337888215-20111-1-git-send-email-jcamins@cpbibliography.com> Message-ID: <1337888215-20111-2-git-send-email-jcamins@cpbibliography.com> Adds the ability to automatically increment biblioitems.totalissues whenever an item is issued. To test: 1) Choose a record with at least one item that can circulate 2) Check the value of 942$0 (you may need to look at the plain MARC view on the OPAC). Most likely there won't be any 942$0 at all 3) Enable UpdateTotalIssuesOnCirc 4) Check out the item you selected 5) Check the value of 942$0 (you may need to look at the plain MARC view on the OPAC). That value should now be one greater than before 6) Discharge the item 7) Disable UpdateTotalIssuesOnCirc 8) Check out the item you selected again 9) Check the value of 942$0 (you may need to look at the plain MARC view on the OPAC). That value should not have changed --- C4/Biblio.pm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ C4/Circulation.pm | 3 +++ 2 files changed, 51 insertions(+), 0 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 5508cbe..42d445f 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -103,6 +103,7 @@ BEGIN { &ModBiblio &ModBiblioframework &ModZebra + &UpdateTotalIssues ); # To delete something @@ -3780,6 +3781,53 @@ sub prepare_host_field { return; } + +=head2 UpdateTotalIssues + + UpdateTotalIssues($biblionumber, $increase, [$value]) + +Update the total issue count for a particular bib record. + +=over 4 + +=item C<$biblionumber> is the biblionumber of the bib to update + +=item C<$increase> is the amount to increase (or decrease) the total issues count by + +=item C<$value> is the absolute value that total issues count should be set to. If provided, C<$increase> is ignored. + +=back + +=cut + +sub UpdateTotalIssues { + my ($biblionumber, $increase, $value) = @_; + my $totalissues; + + my $data = GetBiblioData($biblionumber); + + if (defined $value) { + $totalissues = $value; + } else { + $totalissues = $data->{'totalissues'} + $increase; + } + my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField('biblioitems.totalissues', $data->{'frameworkcode'}); + + my $record = GetMarcBiblio($biblionumber); + + my $field = $record->field($totalissuestag); + if (defined $field) { + $field->update( $totalissuessubfield => $totalissues ); + } else { + $field = MARC::Field->new($totalissuestag, '0', '0', + $totalissuessubfield => $totalissues); + $record->insert_grouped_field($field); + } + + ModBiblio($record, $biblionumber, $data->{'frameworkcode'}); + return; +} + 1; diff --git a/C4/Circulation.pm b/C4/Circulation.pm index c26de76..b97cf6e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1059,6 +1059,9 @@ sub AddIssue { CartToShelf( $item->{'itemnumber'} ); } $item->{'issues'}++; + if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { + UpdateTotalIssues($item->{'biblionumber'}, 1); + } ## If item was lost, it has now been found, reverse any list item charges if neccessary. if ( $item->{'itemlost'} ) { -- 1.7.2.5 From jcamins at cpbibliography.com Thu May 24 21:36:55 2012 From: jcamins at cpbibliography.com (Jared Camins-Esakov) Date: Thu, 24 May 2012 15:36:55 -0400 Subject: [Koha-patches] [PATCH 3/3] Bug 6557: add script to update totalissues from stats In-Reply-To: <1337888215-20111-1-git-send-email-jcamins@cpbibliography.com> References: <1337888215-20111-1-git-send-email-jcamins@cpbibliography.com> Message-ID: <1337888215-20111-3-git-send-email-jcamins@cpbibliography.com> NAME update_totalissues.pl SYNOPSIS update_totalissues.pl --use-stats update_totalissues.pl --use-items update_totalissues.pl --commit=1000 update_totalissues.pl --since='2012-01-01' update_totalissues.pl --interval=30d DESCRIPTION This batch job populates bibliographic records' total issues count based on historical issue statistics. --help Prints this help -v|--verbose Provide verbose log information (list every bib modified). --use-stats Use the data in the statistics table for populating total issues. --use-items Use items.issues data for populating total issues. Note that issues data from the items table does not respect the --since or --interval options, by definition. Also note that if both --use-stats and --use-items are specified, the count of biblios processed will be misleading. -s|--since=DATE Only process issues recorded in the statistics table since DATE. -i|--interval=S Only process issues recorded in the statistics table in the last N units of time. The interval should consist of a number with a one-letter unit suffix. The valid suffixes are h (hours), d (days), w (weeks), m (months), and y (years). The default unit is days. --incremental Add the number of issues found in the statistics table to the existing total issues count. Intended so that this script can be used as a cron job to update popularity information during low-usage periods. --commit=N Commit the results to the database after every N records are processed. --test Only test the popularity population script. === TESTING PLAN === NOTE: in order to test this script, you will need to have some sort of circulation data already existing in your Koha installation. 1) Disable UpdateTotalIssuesOnCirc 2) Run: misc/cronjobs/update_total_issues.pl --use-items -t -v 3) If you have total checkout data in your item records (i.e. anything in 952$l), you should see messages like "Processing bib 43 (1 issues)" 4) Choose one of the lines that shows more than 0 issues, and view the record with that biblionumber in the staff client, choosing the "Items" tab (moredetail.pl). Add up the "Total checkouts" listed for each item, and confirm it matches what the script reported 5) Run: misc/cronjobs/update_total_issues.pl --use-stats -t -v 6) If you have any circulation statistics in your database (i.e. any 'issue' entries in your statistics table), you should see messages like "Processing bib 43 (1 issues)"; 7) Choose one of the lines and view the record with that biblionumber in the staff client, choosing the "Items" tab (moredetail.pl). If you count the number of checkouts listed in each item's checkout history, the total should match what the script reported. 8) Check out an item 9) Run: misc/cronjobs/update_total_issues.pl --use-stats --since=1h -t -v 10) You should see one line reporting a single circ for the bib record associated with the item you just checked out (there may be more if you checked out any books in the hour prior to running these tests 11) If the results in steps 4, 7, and 10 match the predictions, the script worked --- misc/cronjobs/crontab.example | 3 + misc/cronjobs/update_totalissues.pl | 272 +++++++++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+), 0 deletions(-) create mode 100755 misc/cronjobs/update_totalissues.pl diff --git a/misc/cronjobs/crontab.example b/misc/cronjobs/crontab.example index 3c5030d..ed8f117 100644 --- a/misc/cronjobs/crontab.example +++ b/misc/cronjobs/crontab.example @@ -67,6 +67,9 @@ KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs # Cancel expired holds 0 1 * * * $KOHA_CRON_PATH/holds/cancel_expired_holds.pl >/dev/null 2>&1 +# Update popularity counts for biblio records +0 2 * * * $KOHA_CRON_PATH/update_totalissues.pl --commit=1000 --use-stats --incremental --interval=1d >/dev/null 2>&1 + # ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day # for both authorities and bibs */10 * * * * $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null diff --git a/misc/cronjobs/update_totalissues.pl b/misc/cronjobs/update_totalissues.pl new file mode 100755 index 0000000..e621b9d --- /dev/null +++ b/misc/cronjobs/update_totalissues.pl @@ -0,0 +1,272 @@ +#!/usr/bin/perl + +# Copyright 2012 C & P Bibliography Services +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use strict; +use warnings; + +BEGIN { + + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} + +use Getopt::Long; +use Pod::Usage; +use C4::Context; +use C4::Biblio; +use DateTime; +use DateTime::Format::MySQL; +use Time::HiRes qw/time/; +use POSIX qw/strftime ceil/; + +sub usage { + pod2usage( -verbose => 2 ); + exit; +} + +$| = 1; + +# command-line parameters +my $verbose = 0; +my $test_only = 0; +my $want_help = 0; +my $since; +my $interval; +my $usestats = 0; +my $useitems = 0; +my $incremental = 0; +my $commit = 100; +my $unit; + +my $result = GetOptions( + 'v|verbose' => \$verbose, + 't|test' => \$test_only, + 's|since=s' => \$since, + 'i|interval=s' => \$interval, + 'use-stats' => \$usestats, + 'use-items' => \$useitems, + 'incremental' => \$incremental, + 'c|commit=i' => \$commit, + 'h|help' => \$want_help +); + +binmode( STDOUT, ":utf8" ); + +if ( defined $since && defined $interval ) { + print "The --since and --interval options are mutually exclusive.\n\n"; + $want_help = 1; +} + +if ( $usestats && $incremental ) { + print + "The --use-items and --incremental options are mutually exclusive.\n\n"; + $want_help = 1; +} + +unless ( $usestats || $useitems ) { + print "You must specify either --use-stats and/or --use-items.\n\n"; + $want_help = 1; +} + +if ( not $result or $want_help ) { + usage(); +} + +my $dbh = C4::Context->dbh; +$dbh->{AutoCommit} = 0; + +my $num_bibs_processed = 0; + +my $starttime = time(); + +process_items() if $useitems; +process_stats() if $usestats; + +report(); + +exit 0; + +sub process_items { + my $query = +"SELECT items.biblionumber, SUM(items.issues) FROM items GROUP BY items.biblionumber;"; + process_query($query); +} + +sub process_stats { + if ($interval) { + my $dt = DateTime->now; + + my %units = ( + h => 'hours', + d => 'days', + w => 'weeks', + m => 'months', + y => 'years' + ); + + $interval =~ m/([0-9]*)([hdwmy]?)$/; + $unit = $2 || 'd'; + $since = DateTime::Format::MySQL->format_datetime( + $dt->subtract( $units{$unit} => $1 ) ); + } + my $limit = ''; + $limit = " AND statistics.datetime >= ?" if ( $interval || $since ); + + my $query = +"SELECT biblio.biblionumber, COUNT(statistics.itemnumber) FROM biblio LEFT JOIN items ON (biblio.biblionumber=items.itemnumber) LEFT JOIN statistics ON (items.itemnumber=statistics.itemnumber) WHERE statistics.type = 'issue' $limit GROUP BY biblio.biblionumber;"; + process_query($query); + + unless ($incremental) { + $query = +"SELECT biblio.biblionumber, 0 FROM biblio LEFT JOIN items ON (biblio.biblionumber=items.itemnumber) LEFT JOIN statistics ON (items.itemnumber=statistics.itemnumber) WHERE statistics.itemnumber IS NULL GROUP BY biblio.biblionumber;"; + process_query($query); + + $query = +"SELECT biblio.biblionumber, 0 FROM biblio LEFT JOIN items ON (biblio.biblionumber=items.itemnumber) WHERE items.itemnumber IS NULL GROUP BY biblio.biblionumber;"; + process_query($query); + } + + $dbh->commit(); +} + +sub process_query { + my $query = shift; + my $sth = $dbh->prepare($query); + + if ($since) { + $sth->execute($since); + } + else { + $sth->execute(); + } + + while ( my ( $biblionumber, $totalissues ) = $sth->fetchrow_array() ) { + $num_bibs_processed++; + print "Processing bib $biblionumber ($totalissues issues)\n" + if $verbose; + if ( not $test_only ) { + if ( $incremental && $totalissues > 0 ) { + UpdateTotalIssues( $biblionumber, $totalissues ); + } + else { + UpdateTotalIssues( $biblionumber, 0, $totalissues ); + } + } + if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { + print_progress_and_commit($num_bibs_processed); + } + } + + $dbh->commit(); +} + +sub report { + my $endtime = time(); + my $totaltime = ceil( ( $endtime - $starttime ) * 1000 ); + $starttime = strftime( '%D %T', localtime($starttime) ); + $endtime = strftime( '%D %T', localtime($endtime) ); + + my $summary = <<_SUMMARY_; + +Update total issues count script report +======================================================= +Run started at: $starttime +Run ended at: $endtime +Total run time: $totaltime ms +Number of bibs modified: $num_bibs_processed +_SUMMARY_ + $summary .= "\n**** Ran in test mode only ****\n" if $test_only; + print $summary; +} + +sub print_progress_and_commit { + my $recs = shift; + $dbh->commit(); + print "... processed $recs records\n"; +} + +=head1 NAME + +update_totalissues.pl + +=head1 SYNOPSIS + + update_totalissues.pl --use-stats + update_totalissues.pl --use-items + update_totalissues.pl --commit=1000 + update_totalissues.pl --since='2012-01-01' + update_totalissues.pl --interval=30d + +=head1 DESCRIPTION + +This batch job populates bibliographic records' total issues count based +on historical issue statistics. + +=over 8 + +=item B<--help> + +Prints this help + +=item B<-v|--verbose> + +Provide verbose log information (list every bib modified). + +=item B<--use-stats> + +Use the data in the statistics table for populating total issues. + +=item B<--use-items> + +Use items.issues data for populating total issues. Note that issues +data from the items table does not respect the --since or --interval +options, by definition. Also note that if both --use-stats and +--use-items are specified, the count of biblios processed will be +misleading. + +=item B<-s|--since=DATE> + +Only process issues recorded in the statistics table since DATE. + +=item B<-i|--interval=S> + +Only process issues recorded in the statistics table in the last N +units of time. The interval should consist of a number with a one-letter +unit suffix. The valid suffixes are h (hours), d (days), w (weeks), +m (months), and y (years). The default unit is days. + +=item B<--incremental> + +Add the number of issues found in the statistics table to the existing +total issues count. Intended so that this script can be used as a cron +job to update popularity information during low-usage periods. + +=item B<--commit=N> + +Commit the results to the database after every N records are processed. + +=item B<--test> + +Only test the popularity population script. + +=back + +=cut -- 1.7.2.5 From srdjan at catalyst.net.nz Fri May 25 04:43:13 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Fri, 25 May 2012 14:43:13 +1200 Subject: [Koha-patches] [PATCH] bug_8039: Try userid if cardnumber borrower search fails in SIP In-Reply-To: References: Message-ID: <1337913793-2270-1-git-send-email-srdjan@catalyst.net.nz> --- C4/SIP/ILS/Patron.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 99fd6e7..ccb08d8 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -37,7 +37,7 @@ sub new { my ($class, $patron_id) = @_; my $type = ref($class) || $class; my $self; - $kp = GetMember(cardnumber=>$patron_id); + $kp = GetMember(cardnumber=>$patron_id) || GetMember(userid=>$patron_id); $debug and warn "new Patron (GetMember): " . Dumper($kp); unless (defined $kp) { syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); -- 1.7.9.5 From robin at catalyst.net.nz Sat May 26 03:43:53 2012 From: robin at catalyst.net.nz (Robin Sheat) Date: Sat, 26 May 2012 13:43:53 +1200 Subject: [Koha-patches] [PATCH] Bug 7642 - OpacShowTagCloudWeight system preference Message-ID: <1337996633-26550-1-git-send-email-robin@catalyst.net.nz> This system preference allows the mouseover text on the tag cloud to be turned off. The text consists of the weight for the tag, but users are more likely to confuse it with the number of items that have this tag. --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../prog/en/modules/admin/preferences/opac.pref | 6 ++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt | 7 ++++++- opac/opac-tags.pl | 7 +++++-- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index cc3a9e2..2c276c6 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -364,3 +364,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SvcMaxReportRows','10','Maximum number of rows to return via the report web service.',NULL,'Integer'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowTagCloudWeight','1','Whether to show the weight of a tag when you hover over its name in the tag cloud',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ca5fb30..f45c657 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5284,6 +5284,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowTagCloudWeight','1','Whether to show the weight of a tag when you hover over its name in the tag cloud',NULL,'YesNo')"); + print "Upgrade to $DBversion done (Add the 'OpacShowTagCloudWeight' system preference)\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index e4ea15b..63ab78b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -223,6 +223,12 @@ OPAC: - '
    Note: Available options are: BIBTEX (bibtex), Dublin Core (dc),' - 'MARCXML (marcxml), MARC-8 encoded MARC (marc8), Unicode/UTF-8 encoded MARC (utf8),' - 'Unicode/UTF-8 encoded MARC without local use -9xx, x9x, xx9- fields and subfields (marcstd), MODS (mods), RIS (ris)' + - + - pref: OpacShowTagCloudWeight + choices: + yes: Show + no: "Don't show" + - 'the numerical weight of a tag when you hover over its name in the tag cloud.' Features: - - pref: opacuserlogin diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt index 1c291c9..b67d4e9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt @@ -90,7 +90,12 @@ [% IF ( TAGLOOP ) %]
    [% FOREACH TAGLOO IN TAGLOOP %] - + [% IF (showweight) %] + + [% ELSE %] + + [% END %] + [% TAGLOO.term |html %] [% TAGLOO.weight_total %] diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index 36bc096..cab0e43 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -234,8 +234,11 @@ if ($loggedinuser) { } } -$template->param(tagsview => 1, -dateformat => C4::Context->preference("dateformat")); +$template->param( + tagsview => 1, + dateformat => C4::Context->preference("dateformat"), + showweight => C4::Context->preference("OpacShowTagCloudWeight") +); if ($add_op) { my $adds = 0; -- 1.7.5.4 From srdjan at catalyst.net.nz Mon May 28 02:14:27 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Mon, 28 May 2012 12:14:27 +1200 Subject: [Koha-patches] [PATCH] bug_8138: added 773$t field to search results In-Reply-To: References: Message-ID: <1338164067-30677-1-git-send-email-srdjan@catalyst.net.nz> --- .../prog/en/xslt/MARC21slim2intranetResults.xsl | 11 +++++++++++ .../prog/en/xslt/MARC21slim2OPACResults.xsl | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl index 6bb1c10..f4554a6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl @@ -436,6 +436,17 @@ + + + + + Source: + + + + + + Type: diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index 4acb90b..5f80c6f 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -516,6 +516,17 @@ + + + + + Source: + + + + + + -- 1.7.9.5 From oleonard at myacpl.org Tue May 29 17:02:03 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Tue, 29 May 2012 11:02:03 -0400 Subject: [Koha-patches] [PATCH] Bug 7747 [FOLLOW-UP] Replace YUI autocomplete with jQueryUI Message-ID: <1338303723-9554-1-git-send-email-oleonard@myacpl.org> This follow-up removes the default jQueryUI images and amends the staff client CSS to override calls to those images with a "Koha- native" style. --- .../intranet-tmpl/prog/en/css/staff-global.css | 11 +++++++++++ .../jquery/images/ui-bg_flat_0_aaaaaa_40x100.png | Bin 180 -> 0 bytes .../jquery/images/ui-bg_flat_75_ffffff_40x100.png | Bin 178 -> 0 bytes .../jquery/images/ui-bg_glass_55_fbf9ee_1x400.png | Bin 120 -> 0 bytes .../jquery/images/ui-bg_glass_65_ffffff_1x400.png | Bin 105 -> 0 bytes .../jquery/images/ui-bg_glass_75_dadada_1x400.png | Bin 111 -> 0 bytes .../jquery/images/ui-bg_glass_75_e6e6e6_1x400.png | Bin 110 -> 0 bytes .../jquery/images/ui-bg_glass_95_fef1ec_1x400.png | Bin 119 -> 0 bytes .../ui-bg_highlight-soft_75_cccccc_1x100.png | Bin 101 -> 0 bytes .../lib/jquery/images/ui-icons_222222_256x240.png | Bin 4369 -> 0 bytes .../lib/jquery/images/ui-icons_2e83ff_256x240.png | Bin 4369 -> 0 bytes .../lib/jquery/images/ui-icons_454545_256x240.png | Bin 4369 -> 0 bytes .../lib/jquery/images/ui-icons_888888_256x240.png | Bin 4369 -> 0 bytes .../lib/jquery/images/ui-icons_cd0a0a_256x240.png | Bin 4369 -> 0 bytes 14 files changed, 11 insertions(+) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_flat_75_ffffff_40x100.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_65_ffffff_1x400.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_75_dadada_1x400.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_95_fef1ec_1x400.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_222222_256x240.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_2e83ff_256x240.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_454545_256x240.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_888888_256x240.png delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_cd0a0a_256x240.png 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 9db80fd..e591a73 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -2260,6 +2260,17 @@ ul.ui-autocomplete { box-shadow: 2px 2px 2px rgba(0,0,0,.3); } +.ui-autocomplete.ui-widget-content { + background-image : none; +} + +.ui-autocomplete.ui-widget-content .ui-state-hover { + border: 1px solid #B9D8D9; + background: #E6F0F2 none; + font-weight: normal; + color: #212121; +} + .ui-autocomplete-loading { background: #FFF url("../../img/loading-small.gif") right center no-repeat; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png deleted file mode 100644 index 5b5dab2ab7b1c50dea9cfe73dc5a269a92d2d4b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 180 zcmeAS at N?(olHy`uVBq!ia0vp^8bF-F!3HG1q!d*FscKIb$B>N1x91EQ4=4yQ7#`R^ z$vje}bP0l+XkK DSH>_4 diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_flat_75_ffffff_40x100.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_flat_75_ffffff_40x100.png deleted file mode 100644 index ac8b229af950c29356abf64a6c4aa894575445f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 178 zcmeAS at N?(olHy`uVBq!ia0vp^8bF-F!3HG1q!d*FsY*{5$B>N1x91EQ4=4yQYz+E8 zPo9&<{J;c_6SHRil>2s{Zw^OT)6 at jj2u|u!(plXsM>LJD`vD!n;OXk;vd$@?2>^GI BH at yG= diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png deleted file mode 100644 index ad3d6346e00f246102f72f2e026ed0491988b394..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 120 zcmeAS at N?(olHy`uVBq!ia0vp^j6gJjgAK^akKnour0hLi978O6-<~(*I$*%ybaDOn z{W;e!B}_MSUQoPXhYd^Y6RUoS1yepnPx`2Kz)7OXQG!!=-jY=F+d2OOy?#DnJ32>z UEim$g7SJdLPgg&ebxsLQ09~*s;{X5v diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_65_ffffff_1x400.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_65_ffffff_1x400.png deleted file mode 100644 index 42ccba269b6e91bef12ad0fa18be651b5ef0ee68..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 105 zcmeAS at N?(olHy`uVBq!ia0vp^j6gJjgAK^akKnouqzpV=978O6-=0?FV^9z|eBtf= z|7WztIJ;WT>{+tN>ySr~=F{k$>;_x^_y?afmf9pRKH0)6?eSP?3s5hEr>mdKI;Vst E0O;M1& diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_75_dadada_1x400.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_glass_75_dadada_1x400.png deleted file mode 100644 index 5a46b47cb16631068aee9e0bd61269fc4e95e5cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 111 zcmeAS at N?(olHy`uVBq!ia0vp^j6gJjgAK^akKnouq|7{B978O6lPf+wIa#m9#>Unb zm^4K~wN3Zq+uP{vDV26o)#~38k_!`W=^oo1w6ixmPC4R1b Tyd6G3lNdZ*{an^LB{Ts5`idse diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png deleted file mode 100644 index 7c9fa6c6edcfcdd3e5b77e6f547b719e6fc66e30..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmeAS at N?(olHy`uVBq!ia0vp^j6j^i!3HGVb)pi0l#Zv1V~E7mPmYTG^FX}c% zlGE{DS1Q;~I7-6ze&TN at +F-xsI6sd%SwK#*O5K|pDRZqEy< zJg0Nd8F@!OxqElm`~U#piM22 at u@8B<moyKE%ct`B(jysxK+1m?G)UyIFs1t0}L zemGR&?jGaM1YQblj?v&@0iXS#fi-VbR9zLEnHLP?xQ|=%Ihrc7^yPWR!tW$yH!zrw z#I2}_!JnT^(qk)VgJr`NGdPtT^dmQIZc%=6nTAyJDXk+^3}wUOilJuwq>s=T_!9V) zr1)DT6VQ2~rgd@!Jlrte3}}m~j}juCS`J4(d-5+e-3 at EzzTJNCE2z)w(kJ90z*QE) zBtnV at 4mM>jTrZZ*$01SnGov0&=A-JrX5Ge%Pce1Vj}=5YQqBD^W at n4KmFxxpFK`uH zP;(xKV+6VJ2|g+?_Lct7`uElL<&jzGS8Gfva2+=8A@#V+xsAj9|Dkg)vL5yhX@~B= zN2KZSAUD%QH`x>H+ at Ou(D1~Pyv#0nc&$!1kI?IO01yw3jD0 at 80qvc?T*Nr8?-%rC8 z at 5$|WY?Hqp`ixmEkzeJTz_`_wsSRi1%Zivd`#+T{Aib6-rf$}M8sz6v zb6ERbr-SniO2wbOv!M4)nb}6UVzoVZEh5kQWh_5x4rYy3c!871NeaM(_p=4(kbS6U#x<*k8Wg^KHs2ttCz<+pBxQ$Z zQMv;kVm5_fF_vH`Mzrq$Y&6u?j6~ftIV0Yg)Nw7JysIN_ z-_n*K_v1c&D}-1{NbBwS2h#m1y0a5RiEcYil+58$8IDh49bPnzE7R8In6P%V{2IZU z7#clr=V4yyrRe at oXNqbqo^^LvlLE?%8XaI&N(Np90-psU}7kqmbWk zZ;YBwJNnNs$~d!mx9oMGyT( znaBoj0d}gpQ^aRr?6nW)$4god*`@Uh2e+YpS at 0(Mw{|z|6ko3NbTvDiCu3YO+)egL z>uW(^ahKFj>iJ-JF!^KhKQyPTznJa;xyHYwxJgr16&Wid_9)-%*mEwo{B_|M9t at S1 zf at T@q?b2Qgl!~_(Roe;fdK)y|XG0;ls;ZbT)w-aOVttk#daQcY7$cpY496H*`m at +L zeP#$&yRbBjFWv}B)|5-1v=(66M_;V1SWv6MHnO}}1=vby&9l+gaP?|pXwp0AFDe#L z&MRJ^*qX6wgxhA_`*o=LGZ>G_NTX%AKHPz4bO^R72ZYK}ale3lffDgM8H!Wrw{B7A z{?c_|dh2J*y8b04c37OmqUw;#;G<* z at nz@dV`;7&^$)e!B}cd5tl0{g(Q>5_7H^@bEJi7;fQ4B$NGZerH#Ae1#8WDTH`iB&) zC6Et3BYY#mcJxh&)b2C^{aLq~psFN)Q1SucCaBaBUr%5PYX{~-q{KGEh)*;n;?75k z=hq%i^I}rd;z-#YyI`8-OfMpWz5kgJE3I!3ean6=UZi!BxG7i(YBk? z02HM7wS0)Wni{dWbQMRtd-A)_Az!t>F;IwWf~!*)-Az4}yryNkz&9)w>ElA80Oc`6 zHo#9H!Y3*Qx9n at Jn)!w6G^hb;e_n8zpIyXCN`JFkPc)^Q?2MsLNFhMgrcZI-<#1ne zjH;KFf?4eAT9mQZ}ZfHLGA#d%s;SZK4p0FwZT2S^{ zQ2BG1xJsbK6?yrHTjJi|5C0u=!|r!?*4FL%y%3q#(d+e>b_2I9!*iI!30}42Ia0bq zUf`Z?LGSEvtz8s``Tg5o_CP(FbR0X$FlE0yCnB7suDPmI2=yOg^*2#cY9o`X z;NY-3VBHZjnVcGS){GZ98{e+lq~O$u6pEcgd0CrnIsWffN1MbCZDH<7c^hv+Z0Ucf0{w zSzi^qKuUHD9Dgp0EAGg@@$zr32dQx>N=ws`MESEsmzgT2&L;?MSTo&ky&!-JR3g~1 zPGTt515X)wr+Bx(G9lWd;@Y3^Vl}50Wb&6-Tiy;HPS0drF`rC}qYq22K4)G#AoD0X zYw$E+Bz at Zr^50MAwu@$?%f9$r4WHH?*2|67&FXFhXBrVFGmg)6?h3^-1?t;UzH0*I zNVf9wQLNLnG2 at q>6CGm>&y|lC`iCFfYd}9i%+xkl^5oBJ?<;aneCfcHqJh7Yl5uLS z9Fx-(kMdcNyZejXh22N{mCw_rX1O!cOE&3>e(ZH81PR95wQC37En4O{w;{3q9n1t&;p)D%&Z%Nw$gSPa!nz8Slh7=ko2am)XARwOWw zpsz0~K!s{(dM$NB=(A=kkp>T(*yU6<_dwIx>cH4+LWl282hXa6-EUq>R3t?G2623< z*RwTN%-fgBmD{fu*ejNn)1 at KG?Sg*8z3hYtkQJQjB6 zQ|x>wA=o$=O)+nLmgTXW3_6diA;b4EY{*i*R%6dO2EMg z at 6g?M3rpbnfB at hOdUeb96=~I?OIA3 at BWAGmTwiQ{x5Cqq<8c10L!P zd at Qk^BseTX%$Q7^s}5n%HB|)gKx}H$d8Sb$bBnq9-AglT2dGR2(+I;_fL|R4p$odJ zllfb0NqI)7=^z~qAm1V{(PkpxXsQ#4*NH9yYZ`Vf@)?#ueGgtCmGGY|9U#v|hRdg- zQ%0#cGIfXCd{Y)JB~qykO;KPvHu|5Ck&(Hn%DF~cct@}j+87xhs2ew;fLm5#2+mb| z8{9e*YI(u|gt|{x1G+U=DA3y)9s2w7 at cvQ($ZJIA)x$e~5_3LKFV~ASci8W}jF&VeJoPDUy(BB>ExJpck;%;!`0AAo zAcHgcnT8%OX&UW_n|%{2B|<6Wp2MMGvd5`T2KKv;ltt_~H+w00x6+SlAD`{K4!9zx z*1?EpQ%Lwiik){3n{-+YNrT;fH_niD_Ng9|58 at m8RsKFVF!6pk at qxa{BH-&8tsim0 zdAQ(GyC^9ane7_KW*#^vMIoeQdpJqmPp%%px3GIftbwESu#+vPyI*YTuJ6+4`z{s? zpkv~0x4c_PFH`-tqafw5)>4AuQ78SkZ!$8}INLK;Egr;2tS18hEO5=t;QDmZ-qu?I zG+=DN`nR72Xto{{bJp||`k}-2G;5#xg8E~xgz22)^_Z;=K|4@(E&5J)SY2of=olcw z5)@L)_Ntcm!*5nEy0M9v0`S33;pO4TN;>4(Z+19p_0>u#e-vE zXCU(6gAvu~I7Cw(xd%0e59MNLw^U37ZDbsBrj%eDCexw8a3G`nTcXVNL6{B7Hj at i& zbVB{;ApEtHk76q08DJ48dSxd$C(;$K6=FpU<~l9pVoT9arW^Vu{%Bcn4`eIpkOVC| z$)AKYG_`ypM{0 at BUb3^9lqi_c?ONH|4UJMJWDowMVjacycX7}9g={O7swOB+{;+?; zjBo!9?+nd)ie#x5IbFW-zBOo0c4q at 9wGVt5;pNt`=-~Zgcw#*`m($6ibxtZ`H=e=} zF#GZ~5$%AUn};8U#tRem0J(JTR}d4vR(dgK2ML~lZsPhayJ2h1%sD4FVst| zKF)+@`iNzLRjg4=K8@**0=5cE>%?FDc({I^+g9USk<8$&^qD~@%W0i4b|yMG*p4`N zh}I!ltTRI8Ex$+ at V{02Br%xq#O?UlhO{r8WsaZnZCZq0MK9%AXU%MDLT;3=0A9(BV z9VxxxJd7jo$hw3q;3o?yBLmA=azBUrd9>-<_ANs0n3?-Ic*6&ytb at H~?0E(*d>T5n z-HiH2jsDf6uWhID%#n>SzOqrFCPDfUcu5QPd?<(=w6pv1BE#nsxS{n!UnC9qAha1< z;3cpZ9A-e$+Y)%b;w@!!YRA9p%Kf9IHGGg^{+p`mh;q8i7}&e at V3EQaMsItEMS&=X plT@$;k0WcB_jb;cn%_Idz4HO$QU*abf4}+wi?e96N>fbq{{i|W0@(ln diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_2e83ff_256x240.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_2e83ff_256x240.png deleted file mode 100644 index 09d1cdc856c292c4ab6dd818c7543ac0828bd616..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4369 zcmd^?`8O2)_s3 at pGmLE*`#M>&Z`mr_kcu#tBo!IbqU=l7VaSrbQrTh%5m}S08Obh0 zGL{*mi8RK}U~J#s at 6Y%1S9~7lb?$xLU+y{go_o*h`AW1wUF3v{Kmh;%r at 5J_9RL9Q zdj+hqg8o{9`K7(TZrR4t{=9O`!T-(~c=yEWZ{eswJJe->5bP8)t4;f(Y*i_HU*sLM z2=7-8guZ}@*(HhVC)Mqgr$3T8?#a(hu& z?Kzuw!O%PM>AicSW`_U(cbvJYv3{HfpIP~Q>@$^c588E$vv)V2c|Mr% zuFO$+I~Hg at u}wPm17n%}j1Y+Pbu!bt?iPkjGAo7>9eRN0FZz3X2_QZj+V!}+*8oBQ z_=iI^_TCA;Ea2tPmRNOeX3+VM>KL;o1(h`c@`6Ah`vdH<&+$yTg)jGWW72T}6J`kUAv?2CgyV zrs0y at Fpvpj@kWVE0TzL at Cy#qHn~kgensb{hIm6J&I8hkoNHOz6o1QQ3QM4NZyu?;= zLd>`wPT*uGr+6vAxYv3k8{gMDR>tO}UavDKzzyi6hvbuP=XQ4Y|A)r4#B$U(q7{1Z z0iLeSjo3;T*diS*me%4|!s23l@>R}rn@#Zc{<%CFt;?gd5S<)b=8Yz32U zBBLprntW3RE3f|uNX5Aw|I(IlJjW-Byd?QFFRk%hLU}O*YyYQel}WcXilLMJp9cB4 z)E?D+*Y4zai&XY!>niMfTW-2pp-^KFT93%Leig at uoQGPYRCva-`w#orm`is`p8b4s zxD462;f*^XO$=3by=VzN9i at xxr<1w=pcxl!$!fjWt|fYmq1@@badT?v`d zIi$|e$Ji}FXsiVYf)?pN1R0LBw;+)B5aUJj2fP+=m;=_Eho84g%Jq#@MLPSQEX*@T z6sZb)m?)zby>{j1)(;rRML|gKSs+9jorf-XhQJ2Jyt5Cqc*`S3iX at A5C3jvgAns|4 z*|)YQ%Kmsj+YZ53;nMqh|AFvehUV-9R;1ZZ;w5r9l}8hjSw@#k;>)$P*r%)=Extyu zB!$Kd-F?*50aJ2;TNTR-fc8B{KAq3!vW{g$LlGPfGW+%#CXU zJDcMsvyT2`x~v>>w8 at yssoA`KuIZ98CLU{Ia%*nW3G4t}@ApsbC at o^WCqL>OXx>Y^ zSuVWEQ;3=A=@RxCnt0>G@#(VWBQ`0$qTwA#e>SX{_N~JWGsBxFHCw|5|?CzDi>92F-^=b*8sMXnhUJdb!>yGD2nhN@{582 zRPcxuDzs&;8De)>_J19z{0xppXQop#T_5ejGCKv at l>$O#DA- at X{y_1B-AsiU)H}DR z3xDZ8G`amV_WmA&8!W=@jgm|%bnwH%qkg(@J$hLaSV zC-rXIFMM%y<|Gb)o?j zpe-`dJ*N5tC-iH)d0CgLdBsw*C!ST9hY1EkI|Y(&=p&dH&q;a&7HXa5#_wtMsenQL zcpyhwx)Ppw at XmVz?P)DI#^ee1oC!i`>>Jq1ESk-OuQ(Pbv=s{A0AjM at rw#FaU;RUh z*At0{U*NtGVY_-JcuG$?zuuf%ZBTWxKU2yf?iN#-MRWs>A*2;p0G1Tp3d29u5RbnY zDOON-G|PidOOGeybnbzu7UVv71l!b=w7eU5l*{EdKuoKu`#LZ}|fnUr-+lSST9(MTT`0tqOG z#+Q_=lXe-=;rE4u8s~;%i~~ z8v&&+VPeXG=2zw9B5sR$e?R(n%nf?p-(BCZ8}x!_-9T+LT;2=Zu?Wv)j3#>35$6dR z4*7xmI)#06qjh#sXvX(%`#D1mD8fn1G~I;l%Dk{pw)}>_{+3^Fv_q)>2#de5qGCId zPz?ix-3954nM&u at vaw{o%-#HU%_bLJMO#@enR^&B{3ihWdoU6%pBJ`o>im+b-c6r-;c{vd0Z_)`75$jApy2?!9G4_FGa)iZ~9`6VELiYM+n!-mUfvfm{jt zC?!1=%pxJhF>vyQ47Q}R;O48pxgMs)rz$SbM&jkp<6X$r4DHWg>ZnGB-$r2o1*nL# zW0^*itcRY_^Uv^XgQP>W#>KQgM~l{;S(GkVW@&vld^AhWzG^m|9#0#USbM>^en{k2 za8~DTL`(Q~=ofsL&Fc`!L6r~qTnnGo8r98<(aG*<0%aNEr!!BIyY>VV82kxhR%d>V(lN&#BId#urK_i~Pe6?>C~J!pU_lRon#&S_cXoQv;poG8FK4atc

    N)npz1~X%p6x{M(Gw!!H=!}lmO0Xr*8ewyH(Q+>oy`fxQkxJ zzzB$)%*xM4s_2(O>)T-QXhwP|&DZam#{O+47q|WKfz_ZL-MypRN~o{fE*I#6 at eM?I zs%f-6{Lz6j7rB#U$%O$~TIT!j?|Ip1CpSmb=JA9qCY3-mQf|fVCxswPjok|VofUEP zW5^pTd5B;wRkyW%1a;nYHB$ef6Pv8^);`m0jv6p72iNJl+sVBqZugsq6cq_pyNREi z>GN!h6ZQ6`aOMr_2KI at j=XR@$aJj(2jcpY?>f=2kMV at di5W7Swj?ug10zRe}F1nR* ztMm6+T^)LJe^SzGgSxahQajq0h7#|8oMV0>D~*N}jl?9_X`ka42R4 at rryDc3o(c$R?1*!1O9zleSOczw zYPS3~xbJ$~C(3+D7Zkrfjs_lneY^zv^kHmxt)aqZ!aeGABHZ`gvA&K`72z}ihI$Ht z9V&)wQy0g at R9irwbf!{uE&_J2l9jXz^Vj#=qA77*3Pd9OjrE_tKDHADd!AjFQv(ji zct-BMUt9()1Ox!dsI_h1(^F_U)_QJrx|%+y`zWWlD4=Nd?JQ=URh0*{fb1!o4tS(H z^r_T(8t1SAHf1oduG+X^*EC_kL(!QnXL6Hp);449yO&1xE>MXGqT)t10lzvALllX;;Q)RiJX$dm zlR8ep5-GdHmRm9?N#QCjNUA);vC03Gw6yds6^?c4;(MH>;O5xmQ2nGK3Dmk8i*v5t z-{jJsQq30%z}0`g7SN-yN`l-`@6rkJ|V|>18`MV zwUeH}DxWw&h+A+Dn|4|YNr&EfKS`Hz_NkeW3*sI5Rq-J&FzG=!{-K`n65#7O%^&f> z`PkqxyC_K)>781~7H${^Nj{`>XEa&OPqqQhySR5%w2{5+sEakXXHazJp6~LP2QKDx zpkvZrkDOa+A4BbqqX6ls&O)5-Q7`qkZ_?6~c-wQ9tseNtET;nhEOL^`*naKwcMX;R zbto&a;oTR0s;vjfj3wigUg)Sj)!OHQfZoJwAsWYI1A4ntz>X=W4s|y?tUk1r=>#Ct zf+?hq^>rQ3$KNboG$UhCdEmp{qAR13DK$f0ES7kAG~7q+g!jfVq`1b5+c62N^0%~o zKw91o at Wv;0EW*7fINAX3O~L-V{`;xB0q()#^HKZOlLrXVL*Dtw-$SUp8*_J{r( zW`6r`cz0yZQ#f0#*y+m64{bs7GP|2V$phf42rswJB?s at 9qf;Bfc^pm-ZS#^5dkG{u zzv;l&B$NYcegSqAnjnPN1?17VUQbPummcWry((85IFB(pFQNGN{hhN$Fv?~l_fr?| z9=%dK(+;kZ(8=mwptjwC-ikBD$Z{l2++~*8wq5ynF<+PNlZI7ba5V#fg~L}kE;UH5 zJ;{P(`G{tNl&z5rUiH~e{I>GT8~9&*(J;Myx9z5P!db!F8RTII^I7c)HU=ss*bYB` zgwiIMZ_q>KEC$4lFm+Afvu6^$X1jm1rB*4H)-EIO5Rvz_p24?OkJ zovD4{-1KA6*oL?a;3qR7GZRB!cE5oAdA#M@{w+fGgsJ-lSmQ^-?8E&Q%tbmjd=@gZ z(}Mg*jsDf6Z)|7s%@9pc-tuw5W&zqUXjv2bVkC%-X?O3F72W4EsIl#1e>Mdz=X4k*_>VxCu_2?jjg16N*5fwC-36OW&;Sz}@jMn}hgJdEd pO;bST+>R{W-aENZYk%(=^(_R5N$LmL{Qc?!%+I4tt4z=_{|902Wu5>4 diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_454545_256x240.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_454545_256x240.png deleted file mode 100644 index 59bd45b907c4fd965697774ce8c5fc6b2fd9c105..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4369 zcmd^?`8O2)_s3^p#%>toqJ#RmwV2==ic*rz7lOw=eaq=H~;_ux21)-Jpcgw zdj+hrf&W^f<%Qk9Zpqf#;jH;N^Z%VA?R|9mZ{esQd(2F=?y+!`XZ5CR?ue=UdHIfUDFM*m15I;g=VN2jw zQW9?wOhDI#+P0|`@JQoC3!pu=AzGMtYB>V&?8(2>_B5_p`1Sb1t{^|J%bZYv09RS? zQ*dcs7}$)taJ at vX0E<96P{ur)Eygr{&ALyNoMP%_94m}=qFVT)&CeG1DBBMLUSKP^ zp%%Q3$MEtKll)X*+$)3O_3x`4%cHY0uhy7U;5x^Ir}X1)mv&B%|A)@A$a>f}tP{5X z9-gkti`YyT+hk9)cZW7fAQhjT%$XLLI^&VR=qev36;`WGBOP!^&(?!sK6jSH0Dnz4 zoEMMNu}y&n=rd-GWI?rGBI8!GD*NJ$k&e5-6+~-9F^6tV<=5`FcY~t{iqRcncEU+F zkT~jww!oy(@~b~WGI8!lzjURX&IpJjFGxShOKUunP+rW$I{c|x0qM6!Gxf6n(;$D> z+QYiULqq)Fy4VDk&Mev)NyM at nvF z7O6M*A$C)kBi0HGMT_+xfQ^USTM)>*h_Rx%eSRxA%n|FuC&=F=Pz}E5uCqbcy;7j=%Qh`glqEA-jx0(a<)uKO5Fe|JLD-ndZ-vnW`G=O&^%pa}Ah(2%m?oANs{lJ`?RhrZ8n!`Q97TKw{YAw9 zD)=M{mD(~_jj`LTd%q6Veum)Cnd!7lw}(5h%ubHcg^2O`prn%u9es3C#&%TsnmSD3%3Ik^Yd at 6-d%(I7kqT(B at dVX2 zIidXgd>qYT-oTZ=1sGI7^*_E9Q)1F2mooE0R zXopPnh^ci at +wz2ZDjo&Owyxh6t90Gt!u0miLxc!bue^LvHF?)O at Yf!dQUXfW$u8(f_n07^N)-vpIe;TrHv5uKm{h_v`-IN^zwWc>Lk ziGsSr89sDcdOR_wa~DjrqV&Nd*$18(vohPJ3hSzEJPF2d!u}415wrSMtS(zNa7 zbO0G4ajgKNp{`D7DO<(T?wowarQ0dIKLb<}#prQM)ytB73YNTPQgX^xoT zm>;yKSJ*c at QfD8HW`6&+mowOaA|A&~G0fO6&xwj;E3O9^Zu~ZXts~;-d%FyyeXrijORi<_S(dw_5 at h&-fTY?#FJo% zQZZ1&ED%$if+n8JVM{s-ZoK at P>p at z4s`AoI6hYxE!Ie_Y)cpjZjc8@~uNMYVfy#J$ z)+sdEX7DK^{}kUAST8U6^p6#c>0Lc>T~9`0}`*2 zizaU)TFS4(u;BenUWZr?s{D)Z)rc9L5&gUvz3iSQaF#J)D)Ts{YgagdDcI1S`dtes zPqb4|h-RIkjhnpmn(Q2Je6Di5C?MkCUL)!WoKn|P#al41v#-Q8`K1$Gh64UhPQj|T zaZb%tJ}O{A?Cvl26!jeKS3OUkp5 at 8RDBYwh`Loxb5W<^m*R37+v}#*m-G{{ocF-#r z7!k3ZS^4Qu9sNRNZ3`laW2TqV{rsR#~gtVp6C zL0?}~gbLTv^jqtPQD at Cpq6{B6v&*Y)?tx})z=qQNB4Z_59 zpI2L)xQ`!|J8wWgs82jSw_8(;#}y7~Y^&hY9P1G)@`CGtIi*tZ%-%&;$PuG(!M%)E zQ?T#imBH8dCZxUBX^RWPwIh9LcnL3#$befQDr at UJl{=}o0){qIt52vU9X=3L_gvVW zPqp_YhhpM6XiE7Lvn-G0Wzo>0;g|$_-7|ucz~*w%bW at hr6M?~v9dT}L=>UotTj13& z?Uvt0_uOvzMq4iG6)gZqeU;W=P at EVod;}Vr7P*@=C19v;iz$4N+c5ewauTtKK5e;yIx(FQUec0 z`G)VlTUY|m2L=KusMRgMlapu#wt8MohK3=y`!J`tD6nYd%?xIZO`Q)skL)R%3Vf(P z__5Sx3h%fKF=sNdZo2p(w=_|}1M%ri7fO?8))sU1ySG;M4p4;zrr}4l0lzvA!WQ&a zrwX>%lJkv`Gr_u=K>kHOg6(AB(R3FOryElY)-vi|fRsBS<)$1;TC_?BnyScjY6>_ZD=T|bjcbjz at D6V+yfHd4SU+J*2Dh%n;$5ou zHh6R=)$>IH@%5js2KH#JkfFCVI}P>~U;|}>kk|06tA}^~B;|gJ$UvSF-l4GX43DAR z&M2mp8OgiTaK4li0|Q2qmGNYsm+Qq^JM8yfCP>5!31rjh4Mnq~+5X8+_$scfP1Fp!c zcQO*#6cfJ?ZRxn_$Se_|}Xo1oIF7s(7CllypCW at W8-y5%Bel_K*0G zd~8UWeYCWz>~^hF3ond|tQcClJ(8^9FW&&?U)a4O-pE;Y*u|FHGax>F*Kg_beOF5c z&?#xRN5Q?ckEwCnNr-${XC=w-te5%QH(6O~yxke=R!_ns))PU07Pu)CY`<>$+XicZ zCI=g^;q7NZnw=-vf;HoWLD+}`&Bph>kiqyX5jxjI1A41d$R3nahq at CHULV#9ItIwJ z0)^JGy{hB;@SD|}Zel8~2z;UjN96MR at dt;EV`9RP4X&zn8ib=n*107cICSp7z6srZ~4Qg|Vp$OB0By{IxAPaD7HGFw_HTza~wWN1A6 z3`7BZFse2a4{y#V^&;nRVcZOz*2>A?jm$%?)KawLR0cEz24qxxOOo9_2)9MrWpSg7 zPiPz+M7(zPRZ3$#11ti?uI!}bM!Dg%L#+uR+^2L2RX+QlMpL zg_DrR=GIT7C~b+^OZK)?l7*9c-78zWVbLo1oS}bItdscuF80}guwA8c^(47DfaBjV z^V@&JJHxYHqS+e7&X;ezZwsE2+t~n0?*m^(db at WnI{LgAnOqOa<8pRvo0E>*O&~J_ z&A)t2LOG)5=3$3n2_gi2Kpvgv)#LCUh2Y~ z!A&(~-8reT$sJk0=L;m~ES3k}k% zkF%gzzT(+nRU0IeUvuW8pq=8uzr&7HW>K5ZiD*8qL17AI^ zGqo>*mvIChU6+&t{A3|!W?~pi9_O$>k2d|#(Z721wcT{S1)_UFZ+}QS^KZ*u?5Y~bz z^cLI;2{$C_ZwWqM at sYMYwG+^N<^Ivq8ZOwV;7xT+WCh)I9PHC}ut;VNr?w z<@?HsG!Qg3zaV+-xQ3ldtad!U<6iGz_enGH*2akP_r)o1D&8p^5M)_c8IIj6Wy*7HJo&CBLuo~nj>(63pZzO(Vv^ZuB3 zMYigjkwA;FEy|G}1jpiMj6|NTm7Uyiw=@FDE*nX<>jR!W at 9XIyf%$Fd*J5*D0Z0Lm z9}ZQxyT|x5ftNy?V>EbJz-K>bV9gs9RaXUP<^=;e?&Fqxj;6{ieR-a- at HycA1KMKhql8GOmcxwZ?_-(3hMK^^a*(gaFvBH ziIC!fgH4$W*NbKIaY&T?%&13``KbD at S-0`xQ%v3TV+B!;RC7O!+1a9QCA$H at 3tR;k z)SSoR7(s4)f{zM}eWgFN{(ZH5d1O}l)f$ruT!)Q&NImXyZsTzOf9TwctcSfr+M)aJ z5otO+$jvm-P4)ykH)x|cO5xeb>?!`qGw$(>&axqLL6yoB${vsMXgL_-bz at 2J_tS92 zdvZG-+vKl at K4Vr(EL{WQt at Z+Ea-hxX0}nTSZxnpi^#Kn8Ox8FgIS|hc}KJQ4tm*HO16ui{(O9} z1YN)GjiQt6fGq`Cj+^`zUf?8hk^(T{{cOQGWFP98am}is28A!5%{R#ENv8fCN!j69 zlMEK(2z?|BY=Je$XD9mB-Kkem*(d-j^9j$2#6r$Dz?s)-TCDCGCs z8>6Pvj{Y+YIeFA at qY22V$)awy at q!9A4rgk5b9TcC;s9Ig^G|6nDP+5=Fzg&?(L=vc zCbGd>fSu~@6!94td+o#d at sid!EIX$rx7*cawe6 z`dScJ+$HssdOjE)O#Ybs56vm-FQ$7yuJJD^Zqk%hMaIgAJ<2yb_MFQte_i;62ScT$ zpjifYyR_E=rQ+>H)pmlr-Udzg*-!|ssw(D7wJvC+Sf8bb9;;q8#z?0p!!bsd{wy|5 zpBaMHE-Ve>i#LLjHRaMLtp%9&(HCng7Sw96jVv!#0k%?F^K7&=T)mnYn)D9(i;4x5 z^NJTJwq~pv;kH@#ejTd*48~(J(r6j34|m`h9fEDj0im)~+%I5XphWymhT;_Zty|Q& zzjPg#-ufAHZ1M*Gccw?Kf|8Pnhtb0`!{N`Bqsa37J+>wC$!e z00k+2Egzz;rbcWoUB%Jvp8W1}$XD%e3>4y;;OZ1ccT-O#uW6Ys at C}Pa`nZrNKzR(2 z4e%3)@QI4SE&E!lW`5y14QhbepBG%_XBV-O(%5tj)@9#|;sC-MNev!zGDHk}JdpGC`iJF#8=8-P$Xoku_=Dw%Cv3{U7L>gf zRQ?<$t`cZ*MP5GQmbmx#!+*!zu>0MewRO9GFGS{b^m_fJ-N0?j at EqoFf>$khj+E|@ z7r3We&^tR^YZrxKe*d22agXqCO0l44&kqCv{u)T|(lv`~PK at DvE z{QI_TlCH5z*gR!>LO)k67{^R+vWx24U2^2ODXpwT;6y+6+$5m)_*w4WY&#do9dCeE z)>p+Ykdhq($DhmMiaYXey!@N%L26uz($aJ!QT{B^Wu}U$^9e#5)=c+XF9 at Ill?ZmM zlNgHiz*9!vDc&uxOo;ZVxb`Q!Sk0*gnfxWzmbZh4(=%CD%qP?0=);n$&zaW_$UKV9 z8axdcN#AyZ{P)wj?V{P}vM)YY!>6@}^>U+iv$`9>nMTCPjN>z%yF&3yf%>+T at 0vh4 zlC8Xa6zeo?%=o3}M8{aebLHcO{^1Ar8qiM=Gquf?Jo)q5`-+?sUpg?QXyEUpWSm+n z$K-UyqkIwHLquru~o(OF)hhz$Y*|X>ZIbswnxRvr~ z2=rdOGVuD|xRlpAZE<0!X1F(%Anpl^@V^D3vbM}qxe|NI;TTiZy7(IM;R69RkA>a& z6gwYE2sREzQ_LHmWqB+ogMk(fMaSFeoDq-!HkFB_nXt5+2ncFuk9BQL1I&oB1zZi) zYW{6_&-Ip1l*OVRA##1ILQS;5R{-K^0wGTiJbVSi at LA^$D$;@J>^G{6@&+%4{b3(s zC~LEHiTv(0b#zxt?YJ0r_~pUZM~mQ(??(n#>&tD%+ at nq=Abj5*8R!~Ul1`G~=qFJ4 zfl|m8ZDCYgtr`4LcOpgiJYX9qRY5;DcWti~PmS$VB$E-Zt^f4)vLDOe_3XTq5^ylW zJ9PKm!V-8sAOJXnUfuFNIf0R9tK-pNs2hO04zr620}5B(Ok>yB)Of-3sP59qfQNbm zA4{w!2 at cB;GbR(~szVrbO%(w=5S!X`o at o@x++wbN_tMPT0Vc)*I;Fgsbf^*g0 z2Di?HTApwKq3+YwfNsqd3iP%{hyK1iyuVZc@*0tO_3+N0#GFsz>8MjeJ2UJ%L!%hi zGYYAthH`E+ywA*u{(eJ=ia3h*%k?779rk-K<0VZAPkl;TFUbmei|$fqWO8!_zIvqt z$ly$VrlH46nnpX~X5Yk0iBJl;=WuA4>~X4-f&K0yWf42h&0b30t at NYX$7egQ1Fp!a zbui-D6cWCWV&|R1CY at G8(qOmWjWeX3eX7UggZPGimA}soOuQdXe4uZ#2>5zN>qlI0 z9xk}lE=tNpX1m6*nFr2EQ3xs79!^sCldDJYE$m(qYv3q7>}1R7?iZW7>$~*%zKaC| z=$N?ME$>#+%T&MZC`dW1wUl6Z)JgyCn~V%K&i0H|iwE%$>xsZW3tTfZxIUePci at p;cRu|d=ItIwF z1clVHy{hH?@SD|(Zfqi^0DQ1hczHN7xq85h)rzQqLHMX2^IkuK7FB!kI40s$|CY7~ zNX^{_UjN8}L%Med;|+=4RNTMozn8KT;2tb77bUPCmioh+rZBfIiM6f_P34cQ__o1G zWqQp3VL~~pE5?qODf%iiQQ3f42YF at 09tQ*$4v_EKUx;t1KCPCBtgqg z at +Tn;O)a0uky_%jm+WjNB?=~VyH>V#L!*=l*@OS6SVyt_UEH&NA=?V2stHPyKkVNy z&jg<#cjros){#ji)dK z%)We0L_478=HZ8- at xnwsKrWs8)x`MB;(Y`Cmu2c-&SH(vN-F(*e`l?c%+l$|y_AJJ zhcDGnwLvN+bu;_sX|1AiePhx at u&%P$hf*xE+O=~D?_(_KGWQ!158YL-y9$*6mmPo;Rp*Dl5lm-mVM2i`h- zM at nxv590_tvMwPD_{l=b$iOm|+|S{D9&P%zeT$GgX6Akl-tfUF>tL at Ld!B&{pN39t zH>3Vhqkr}2Yul+jb7UiouWVGPNsxX7Ueba+9|~dz?d*QM$ng0DZfO0`7fAy?2yMm| zcnRzUhZ&IcwgjH9cuU!w+VStYa{p*)4IgBf|E8)sqMYtB2KH_}SfsFq(c9i(Q6S3U oBo%DI*Kv;w;*%(i9W at f3_WCF#rGn diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_cd0a0a_256x240.png b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/images/ui-icons_cd0a0a_256x240.png deleted file mode 100644 index 2ab019b73ec11a485fa09378f3a0e155194f6a5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4369 zcmd^?`8O2)_s3 at pGmLE*`#M>&Z`mr_kcwz5Nh&gy7G+@45H9p05OJ)J0CH2owMSaGIN$+5!N; z<11j56?ANg=9hMl-IBGX-T8hf$N$b*H?$f4Xt&I`oABt1nR=k%#z{{*a!Axm|t}hCz zJg0Ln7;M4Zjx{$mwhMW+kWN;|j>qTx_-zNX!GzqEZRa}QF8_0yk6+=w}$QD^&hM4%OkT=uh$q9;5u~NL-I+NQyaVc|3l+iWI5~|(hA-G z08i8AMr@{uY_cWTxo^y|Qyb33mlZLvc7H2Zm~>mB7&=-1X^@|D z&0*~i?GBE&NM(Pv&Vt^zWu_bD3e|R?wTL{cSFwD^Ij9v%g=aLY at 1U2Bxn#Te*{>%D zOOW-O-bfnJ7T8jd<*>8`Z2DsFQi~S$%^npJwXam5>>p zMd}QEjM)@~##n$LXpz1Hkl|2UGXi-JFFePXBWL+-5f%!S>L#KL3>Vl0w#d^21Jn<~_7q zWx^Xg1(>PsPGO&cu{S;(pRQ;=Vw2J<9NdQVWx<+g-`ia=Q at puS)75M+?u>DTa95e9 zt#1T?#a)uWC>Mia!K6>g|InPW{&Kp9$tC_3*;R_Xsz6^Eu|xW1$6j#0?XLs7^l+%O zlxddE)h^|=K(2UqS*0ECuDe0ic|H_^t*VOoTCKx0Qmn_^LyJ|b8l$Jvl3{2=3x8&7 z$1ik&YG>w#@x at y~$r`fhlUDo;yXecc6$`30m`3K8s{k8G&3RVp8n#|l6h(Xw`Axw9 z%6Y^J6k0P at 4YAuSd%q7=eg)&u8EMoEmq$CWj1GY|rGQWw3ida!FHk&wCqrQh_0Bcw z!ZBS3CbxgZ+}~wzgGIQ#QId%T_TE~_qdUqxjqS#8#jPxdwO@(@-5_nSP&uT?aGYYD z6km36K9=gjUjImwO=5Hl#u85VF?r0HbW)#h^SR|s_L47Tl$&Z&Rz*ksl!t*(2O2;D z+8`6$qpLn}LchhCmv*X}moGMX5?F@juGeHQAddAn}0~r zS_0|d3*0v%Y)8+8K{ zGyoYPb|W9Grm9M4E?vb^@16ePbI4omZv+(NoZ##fLUmKlB(G_jEbtDCM*27t$v`JovAZa+%*Q5dDXF*Ftt*n!O>#ohCM4lZ)h5rdKV-3A za}2AO6@!`W>ROk5FN*>2Zza^Z%}8KT%*jBGH|rml2X1LR{wZhWx8V4>|5i}; zMnLIHn3!^)`87GYh}&Y`KMwyLbA#^pch}Z!`@P_qH&N^LS9SxpEy8mc!wFusq&Z@` zeO}<6PC at VNaII|=n(^cNUiLseig*$;NjG7;IwvfYCBN>kzv@v-V2eBQZ at oIs^)NLqMR935k|1}U;5<{s(Ebdj4r`?QtrrAPfQooq zmPs_(YTy|??+nitNIFDoR7~qLPPFFCf^_~8OUt{#!|9o*3Q{!@9ZAI$7O~piD!;WX8#v&RxNH27i59$`1{o zEYU_zE{bKEI%f3BbE0Fc;f2!4LjUlC`wgh4 at R{1?O78r5t$hWKiLV{#QWWq{QZiPx zm3?x$;&DDRVt0SByRiFczw$-e)GSvpCRbzk^=E zz=(+LjEc{Ps_2(OYg=G(93!oS=IeJ|WA8STv+LgI*Oj1c-QC06N~mvJ&KKx{arGp5 zswvJ6{%BvBYo>#2$%O$~TITuh?Rr^jCpAUXh)}m74`O|aOU>w2KI`k<#efwa5=-l4Xx!o>Z9Evg`RLN5W7SQp3$@D3_hY4EV!0( ztMm6>zBcgY{RvHZ{9Ey&&)jr2B4s0qDPBUh1ITaAp&>rj3ng*B=VGXz* zs at eR<;J(XkpD6Q1U3}#FR)wlafiFMU(-=&e9(eQ`isrS-9aNwJ)7frS8RiXM4*SbC zL|4*c?h^jfYvSOpn%Z$W?C|TuZ;uy2pFWHXuGW`ZkGV&kPJsKqJJQ!NswAE!!cb2k zumi=AE$YIkm})cVlg>nn&PBjBRI*@mfhhRMsa5U8k#A!ztfiw)d7I_UyAif8$5sJ9a7WUv5!o%fL z(J7-8EQzv1YIc)BNeWkLK~m%y4vqe&q@|_ZR5;eC3-9rkf*T{_19jtuWKhdW4Bn|~ zZ-YyFLN!k)0AKg{dO)|v3K?=oy+dzb4%T1F4}JsByncB1Z(`2p at O0!E!JQelouN^* z%Q^YfQUh66D$Zx-RDZvLctsr9`_+1p#tz&4SMd at i_-8()tyg3OyhU~?Gt#-a{NKFN z0VGf+AH%@o6;-_*?$$T4QX-f_>Ny-5CV8Ccq+@>gNSeovbFr0 at b}RiTcJbLx>ws&r zsvY!rR{4al#MpVKut~?&kTmF>_v3UaC!gvuxgg%5-{l{20}~&F6CUarF9N=u)BG71 zoQDlAwT+T=mfo&$Xy%4-kmW;4wuh6{{ABClybHV6L>t&k4?9_Ny8A_^?)ff#dEjhL z2RbC~cFVbz^fJ`$I0%prYc0g-9(7X3eUp}^#Mzv)Z1EsGW;qr3cY$+e2HU5d_O9L% zpbljP*1!A0PqpzNo3W&y(hD87qgweq5YQWYEkxrOuSain2-q at Z*P`x*ht-9)Fr5Ho zSTKduvc9h6`S^#$i)LgjDi3_PQ+RbaGP!!di^Y;4kB0lGo$y{if)rJIaXTbpRgO#B z1El6|18;s}$0FRjgK-7~ZwmI`_1{a`32+Y>&O_iTpm%vz6hNkjGR(#*! zpfJ2>OAQbTFba9S3j9BlRHXaG{)Zt(J<3ppA?}j+7F#{bV{M7zU)5e@~R&J_xf$+GKK~ z3{R;Y9fZGe^ifEqKL;!VMXv26=R~^TG(#*2!JKCWoo&c^$utAs#Gfq-?t!c&9TH5- zj&i5L4NWbdNs*djvsY}bC&ddUbh=iyc0;3- at Y#d^s8|Ql{ax(yenFcG#i|K%lRxy| zFys4w!@EPXp2AsbMUGc*eP|7uliAq-O6~(+MR>V(EZTd&9G+MY&gF2lZ=I8j*o`OC z`AxrmOGMeD=H_9Cq47clT|h34>-EI=%;E!my;o&wU(aKV&PymBzrV9q2uA62XS at JrjKYANZAU>;8mag#BU?Nv`+ZVhlAPV`HF_gKY_O zhbV2L`8qvR&f=@M5vH~geD+L&*L2s<)|5)clA0yt9TM{X)iWtx at wJO_!{vR#|AD6t z*OAg2&P_i8jjW5y0DdtOGcqvrCHD*1Uq_q1ZQmngPnf!2fHizH%sSX>#$2Rh!>1ur z+s(*-)abDuePc6~XNG8m@|KMXHVM#G4?~+V z1z!An!D0GD-7WqXE8ddUXLkI%u01$fTEhhy This patch creates a new system preference, OpacRightSidebar, in which the librarian can add HTML which will appear on the OPAC main page under the login form. If the user is logged in the content will appear in place of the login form. --- C4/Auth.pm | 2 ++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 +++++++ .../prog/en/modules/admin/preferences/opac.pref | 5 +++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt | 23 ++++++++++---------- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index ffee1bb..302178b 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -426,6 +426,7 @@ sub get_template_and_user { OpacKohaUrl => C4::Context->preference("OpacKohaUrl"), OpacMainUserBlock => "" . C4::Context->preference("OpacMainUserBlock"), OpacNav => "" . C4::Context->preference("OpacNav"), + OpacRightSidebar => "" . C4::Context->preference("OpacRightSidebar"), OpacNavBottom => "" . C4::Context->preference("OpacNavBottom"), OpacPasswordChange => C4::Context->preference("OpacPasswordChange"), OPACPatronDetails => C4::Context->preference("OPACPatronDetails"), @@ -962,6 +963,7 @@ sub checkauth { LibraryName => C4::Context->preference("LibraryName"), opacuserlogin => C4::Context->preference("opacuserlogin"), OpacNav => C4::Context->preference("OpacNav"), + OpacRightSidebar => C4::Context->preference("OpacRightSidebar"), OpacNavBottom => C4::Context->preference("OpacNavBottom"), opaccredits => C4::Context->preference("opaccredits"), OpacFavicon => C4::Context->preference("OpacFavicon"), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 2ffe2df..e863255 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -82,6 +82,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacMaintenance',0,'If ON, enables maintenance warning in OPAC','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacMainUserBlock','Welcome to Koha...\r\n


    ','A user-defined block of HTML in the main content area of the opac main page','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacNav','Important links here.','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','70|10','Textarea'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacRightSidebar','','Show the following HTML in the right hand column of the main page under the main login form','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacNavBottom','Important links here.','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACNoResultsFound','','Display this HTML when no results are found for a search in the OPAC','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPasswordChange',1,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 51a6486..7a54160 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5307,6 +5307,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } + +$DBversion = "3.09.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacRightSidebar', '', '70|10', 'Show the following HTML in the right hand column of the main page under the main login form', 'Textarea');"); + print "Upgrade to $DBversion done (Add customizable OpacRightSidebar region to the OPAC main page)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index e4ea15b..ef763c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -165,6 +165,11 @@ OPAC: type: textarea class: code - + - "Show the following HTML in the right hand column of the main page under the main login form:" + - pref: OpacRightSidebar + type: textarea + class: code + - - "Show the following HTML on the left hand column of the main page and patron account on the OPAC, after OpacNav, and before patron account links if available:" - pref: OpacNavBottom type: textarea diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt index a89c473..aaa955c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt @@ -12,17 +12,14 @@
    [% IF ( opacuserlogin ) %] [% IF ( loggedinusername ) %] -
    -
    +
    [% ELSE %] -
    -
    +
    [% END %] [% ELSE %] -
    -
    +
    [% END %] - +
    [% IF ( koha_news_count ) %]
    @@ -43,10 +40,11 @@ - [% IF ( opacuserlogin ) %] + [% IF ( opacuserlogin || OpacRightSidebar ) %] +
    + [% IF ( opacuserlogin ) %] [% UNLESS ( loggedinusername ) %] [% UNLESS ( casAuthentication ) %] -
    @@ -60,11 +58,12 @@
    -
    [% END %] [% END %] - -[% END %] + [% END %] + [% IF ( OpacRightSidebar ) %]
    [% OpacRightSidebar %]
    [% END %] +
    + [% END %] -- 1.7.9.5 From oleonard at myacpl.org Tue May 29 22:13:56 2012 From: oleonard at myacpl.org (Owen Leonard) Date: Tue, 29 May 2012 16:13:56 -0400 Subject: [Koha-patches] [PATCH] Bug 8160 - Link to cataloging appears for users without cataloging permission Message-ID: <1338322436-13072-1-git-send-email-oleonard@myacpl.org> This patch wraps cataloging links on the staff client home page and in the header menu with checks for edit_catalogue OR edit_items permission. To test, access the staff client as a user with various permissions. The "cataloging" link on the main page and in the header menu should only appear to a user with edit_catalogue permission, edit_items permission, or both. --- .../intranet-tmpl/prog/en/includes/header.inc | 2 +- .../intranet-tmpl/prog/en/modules/intranet-main.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 4783523..3d71d45 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -16,7 +16,7 @@
    • Lists
    • - [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] + [% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items ) %]
    • Cataloging
    • [% END %] [% IF ( CAN_user_acquisition ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt index 0e9aed6..492dca4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -41,7 +41,7 @@ Lists - [% IF ( CAN_user_catalogue || CAN_user_editcatalogue ) %] + [% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items ) %]
    • Cataloging
    • -- 1.7.9.5 From srdjan at catalyst.net.nz Wed May 30 03:39:54 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Wed, 30 May 2012 13:39:54 +1200 Subject: [Koha-patches] [PATCH] bug_8039: Try userid if cardnumber borrower search fails in SIP In-Reply-To: References: Message-ID: <1338341994-30700-1-git-send-email-srdjan@catalyst.net.nz> --- C4/SIP/ILS/Patron.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 99fd6e7..8017ed3 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -37,13 +37,13 @@ sub new { my ($class, $patron_id) = @_; my $type = ref($class) || $class; my $self; - $kp = GetMember(cardnumber=>$patron_id); + $kp = GetMember(cardnumber=>$patron_id) || GetMember(userid=>$patron_id); $debug and warn "new Patron (GetMember): " . Dumper($kp); unless (defined $kp) { syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); return undef; } - $kp = GetMemberDetails(undef,$patron_id); + $kp = GetMemberDetails($kp->{borrowernumber}); $debug and warn "new Patron (GetMemberDetails): " . Dumper($kp); my $pw = $kp->{password}; ### FIXME - md5hash -- deal with . my $flags = $kp->{flags}; # or warn "Warning: No flags from patron object for '$patron_id'"; -- 1.7.9.5 From amit.gupta at osslabs.biz Wed May 30 09:14:23 2012 From: amit.gupta at osslabs.biz (Amit Gupta) Date: Wed, 30 May 2012 12:44:23 +0530 Subject: [Koha-patches] [PATCH] Bug 8166 - Adding new currencies & exchange rates Message-ID: <1338362063-30314-1-git-send-email-amit.gupta@osslabs.biz> if not fill any field it save blank record To Test: 1) Go to Currencies & Exchange rates. 2) Create New currency 3) If you not fill any field for ex: (Currency, rate, symbol) it will not save the record. --- .../prog/en/modules/admin/currency.tt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt index d2d0597..6a42f18 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt @@ -120,7 +120,7 @@
      - + Cancel
      -- 1.6.4.2 From srdjan at catalyst.net.nz Thu May 31 02:04:26 2012 From: srdjan at catalyst.net.nz (Srdjan) Date: Thu, 31 May 2012 12:04:26 +1200 Subject: [Koha-patches] [PATCH] bug_7420: Added overduefinescap to issuingrules In-Reply-To: References: Message-ID: <1338422666-10001-1-git-send-email-srdjan@catalyst.net.nz> Replaced existing MaxFine syspref logic with overduefinescap. Repurposed MaxFine to be the overall overdue limit for all items overdue. Implemented new MaxFine logic in UpdateFine(). --- C4/Circulation.pm | 2 +- C4/Overdues.pm | 48 +++++++++++++++----- admin/smart-rules.pl | 9 ++-- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 15 ++++++ .../prog/en/modules/admin/preferences/patrons.pref | 3 +- .../prog/en/modules/admin/smart-rules.tt | 3 ++ misc/cronjobs/fines.pl | 4 +- misc/cronjobs/staticfines.pl | 2 +- 10 files changed, 67 insertions(+), 22 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index c26de76..91e35d8 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1615,7 +1615,7 @@ sub AddReturn { if ($borrowernumber) { if($issue->{'overdue'}){ - my ( $amount, $type, $daycounttotal ) = C4::Overdues::CalcFine( $item, $borrower->{categorycode},$branch, $datedue, $today ); + my ( $amount, $type, $unitcounttotal ) = C4::Overdues::CalcFine( $item, $borrower->{categorycode},$branch, $datedue, $today ); $type ||= q{}; if ( $amount > 0 && ( C4::Context->preference('finesMode') eq 'production' )) { C4::Overdues::UpdateFine( diff --git a/C4/Overdues.pm b/C4/Overdues.pm index c7430c9..bcc641d 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -241,8 +241,8 @@ C<$amount> is the fine owed by the patron (see above). C<$chargename> is the chargename field from the applicable record in the categoryitem table, whatever that is. -C<$daycount> is the number of days between start and end dates, Calendar adjusted (where needed), -minus any applicable grace period. +C<$unitcount> is the number of chargeable units (days between start and end dates, Calendar adjusted where needed, +minus any applicable grace period, or hours) FIXME - What is chargename supposed to be ? @@ -268,10 +268,9 @@ sub CalcFine { } else { # a zero (or null) chargeperiod means no charge. } - if(C4::Context->preference('maxFine') && ( $amount > C4::Context->preference('maxFine'))) { - $amount = C4::Context->preference('maxFine'); - } - return ($amount, $data->{chargename}, $units_minus_grace); + $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap}; + $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); + return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); # FIXME: chargename is NEVER populated anywhere. } @@ -521,14 +520,39 @@ sub UpdateFine { # "REF" is Cash Refund my $sth = $dbh->prepare( "SELECT * FROM accountlines - WHERE itemnumber=? - AND borrowernumber=? - AND accounttype IN ('FU','O','F','M') - AND description like ? " + WHERE borrowernumber=? + AND accounttype IN ('FU','O','F','M')" ); - $sth->execute( $itemnum, $borrowernumber, "%$due%" ); + $sth->execute( $borrowernumber ); + my $data; + my $total_amount_other = 0.00; + my $due_qr = qr/$due/; + # Cycle through the fines and + # - find line that relates to the requested $itemnum + # - accumulate fines for other items + # so we can update $itemnum fine taking in account fine caps + while (my $rec = $sth->fetchrow_hashref) { + if ($rec->{itemnumber} == $itemnum && $rec->{description} =~ /$due_qr/) { + if ($data) { + warn "Not a unique accountlines record for item $itemnum borrower $borrowernumber"; + } else { + $data = $rec; + next; + } + } + $total_amount_other += $rec->{'amount'}; + } + if (my $maxfine = C4::Context->preference('MaxFine')) { + if ($total_amount_other + $amount > $maxfine) { + my $new_amount = $maxfine - $total_amount_other; + warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached"; + return if $new_amount <= 0.00; + + $amount = $new_amount; + } + } - if ( my $data = $sth->fetchrow_hashref ) { + if ( $data ) { # we're updating an existing fine. Only modify if amount changed # Note that in the current implementation, you cannot pay against an accruing fine diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 8e5a2d5..03463b9 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -101,8 +101,8 @@ elsif ($op eq 'delete-branch-item') { # save the values entered elsif ($op eq 'add') { my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?'); - my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); - my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); + my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); + my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); my $br = $branch; # branch my $bor = $input->param('categorycode'); # borrower category @@ -122,14 +122,15 @@ elsif ($op eq 'add') { $hardduedate = format_date_in_iso($hardduedate); my $hardduedatecompare = $input->param('hardduedatecompare'); my $rentaldiscount = $input->param('rentaldiscount'); + my $overduefinescap = $input->param('overduefinescap') || undef; $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty"; $sth_search->execute($br,$bor,$cat); my $res = $sth_search->fetchrow_hashref(); if ($res->{total}) { - $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount, $br,$bor,$cat); + $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); } else { - $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount); + $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); } } elsif ($op eq "set-branch-defaults") { diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 12ea9d1..1039740 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -996,6 +996,7 @@ CREATE TABLE `issuingrules` ( `renewalsallowed` smallint(6) NOT NULL default "0", `reservesallowed` smallint(6) NOT NULL default "0", `branchcode` varchar(10) NOT NULL default '', + overduefinescap decimal default NULL, PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`), KEY `categorycode` (`categorycode`), KEY `itemtype` (`itemtype`) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 2ffe2df..4b10e20 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -62,7 +62,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES -- this is selected by the web installer now -- INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('marcflavour','MARC21','Define global MARC flavor (MARC21 or UNIMARC) used for character encoding','MARC21|UNIMARC','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MARCOrgCode','OSt','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','','free'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',9999,'Maximum fine a patron can have for a single late return','','Integer'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',NULL,'Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxoutstanding',5,'maximum amount withstanding to be able make holds','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxreserves',50,'Define maximum number of holds a patron can place','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxItemsInSearchResults',20,'Specify the maximum number of items to display for each result on a page of results',NULL,'free'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 51a6486..0cab0c5 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5307,6 +5307,21 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } + + +$DBversion = '3.09.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE issuingrules ADD overduefinescap decimal DEFAULT NULL"); + my $maxfine = C4::Context->preference('MaxFine'); + if ($maxfine && $maxfine < 900) { # an arbitrary value that tells us it's not "some huge value" + $dbh->do("UPDATE issuingrules SET overduefinescap=?",undef,$maxfine); + $dbh->do("UPDATE systempreferences SET value = NULL WHERE variable = 'MaxFine'"); + } + $dbh->do("UPDATE systempreferences SET explanation = 'Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.' WHERE variable = 'MaxFine'"); + print "Upgrade to $DBversion done (Bug 7420 add overduefinescap to circulation matrix)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 55b4457..5600874 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -74,10 +74,11 @@ Patrons: no: "Don't allow" - "staff to access a patron's checkout history (it is stored regardless)." - - - The late fine for a specific checkout will only go up to + - The late fine for all checkouts will only go up to - pref: MaxFine class: currency - '[% local_currency %].' + - Empty value means no limit. Single item caps are specified in the circulation rules matrix. - - pref: memberofinstitution choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index 635051f..dd77946 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -78,6 +78,7 @@ for="tobranch">Clone these rules to: Clone these rules to:
    @@ -182,6 +184,7 @@ for="tobranch">Clone these rules to: + diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl index 5124f3c..25a8122 100755 --- a/misc/cronjobs/fines.pl +++ b/misc/cronjobs/fines.pl @@ -110,7 +110,7 @@ for my $overdue ( @{$overdues} ) { } ++$counted; - my ( $amount, $type, $daycounttotal ) = + my ( $amount, $type, $unitcounttotal ) = CalcFine( $overdue, $borrower->{categorycode}, $branchcode, $datedue, $today ); @@ -131,7 +131,7 @@ for my $overdue ( @{$overdues} ) { push @cells, map { defined $borrower->{$_} ? $borrower->{$_} : q{} } @borrower_fields; push @cells, map { $overdue->{$_} } @item_fields; - push @cells, $type, $daycounttotal, $amount; + push @cells, $type, $unitcounttotal, $amount; say {$fh} join $delim, @cells; } close $fh; diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl index 35264dc..098fae6 100755 --- a/misc/cronjobs/staticfines.pl +++ b/misc/cronjobs/staticfines.pl @@ -176,7 +176,7 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { ( $datedue_days <= $today_days ) or next; # or it's not overdue, right? $overdueItemsCounted++; - my ( $amount, $type, $daycounttotal, $daycount ) = CalcFine( $data->[$i], $borrower->{'categorycode'}, $branchcode, undef, undef, $datedue, $today ); + my ( $amount, $type, $unitcounttotal, $unitcount ) = CalcFine( $data->[$i], $borrower->{'categorycode'}, $branchcode, undef, undef, $datedue, $today ); # Reassign fine's amount if specified in command-line $amount = $catamounts{$borrower->{'categorycode'}} if (defined $catamounts{$borrower->{'categorycode'}}); -- 1.7.9.5 From kyle at bywatersolutions.com Thu May 17 16:40:30 2012 From: kyle at bywatersolutions.com (Kyle M Hall) Date: Thu, 17 May 2012 10:40:30 -0400 Subject: [PATCH 1/2] [SIGNED-OFF] Bug 8112 - Overdues with Fines giving duplicates Message-ID: If a borrower has multiple fines of type FU for a given item, that row will appear in the Overdues with Fines report for each fine on record. Fixed by grouping the results by borrowernumber. Signed-off-by: wajasu --- C4/Overdues.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index d17f445..e2a8abf 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -1261,10 +1261,10 @@ sub GetOverduesForBranch { my $i = 0; my $sth; if ($location) { - $sth = $dbh->prepare("$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname"); + $sth = $dbh->prepare("$select AND items.location = ? GROUP BY borrowers.borrowernumber ORDER BY borrowers.surname, borrowers.firstname"); $sth->execute($branch, $location); } else { - $sth = $dbh->prepare("$select ORDER BY borrowers.surname, borrowers.firstname"); + $sth = $dbh->prepare("$select GROUP BY borrowers.borrowernumber ORDER BY borrowers.surname, borrowers.firstname"); $sth->execute($branch); } while ( my $data = $sth->fetchrow_hashref ) { -- 1.7.11.4 ------=_Part_6667_14646208.1345762482154 Content-Disposition: attachment; filename="0002-SIGNED-OFF-Bug-8112-Overdues-with-Fines-dup-Followup.patch" Content-Type: text/x-patch; name=0002-SIGNED-OFF-Bug-8112-Overdues-with-Fines-dup-Followup.patch; charset=us-ascii Content-Transfer-Encoding: 7bit
    [% rule.finedays %] [% rule.renewalsallowed %] [% rule.reservesallowed %]