diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm
index 282c802f12..e1838b6f03 100644
--- a/Koha/Schema/Result/Issue.pm
+++ b/Koha/Schema/Result/Issue.pm
@@ -184,10 +184,34 @@ __PACKAGE__->belongs_to(
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZEh31EKBmURMKxDxI+H3EA
__PACKAGE__->belongs_to(
- "borrower",
- "Koha::Schema::Result::Borrower",
- { borrowernumber => "borrowernumber" },
- { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
+ "borrower",
+ "Koha::Schema::Result::Borrower",
+ { borrowernumber => "borrowernumber" },
+ { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
+);
+
+__PACKAGE__->belongs_to(
+ "item",
+ "Koha::Schema::Result::Item",
+ { itemnumber => "itemnumber" },
+ {
+ is_deferrable => 1,
+ join_type => "LEFT",
+ on_delete => "CASCADE",
+ on_update => "CASCADE",
+ },
+);
+
+__PACKAGE__->belongs_to(
+ "branch",
+ "Koha::Schema::Result::Branch",
+ { branchcode => "branchcode" },
+ {
+ is_deferrable => 1,
+ join_type => "LEFT",
+ on_delete => "CASCADE",
+ on_update => "CASCADE",
+ },
);
1;
diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm
index 527651d506..184a854e09 100644
--- a/Koha/Schema/Result/Reserve.pm
+++ b/Koha/Schema/Result/Reserve.pm
@@ -288,6 +288,28 @@ __PACKAGE__->belongs_to(
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ig/fobzvZf1OgAHZFtkyyQ
+__PACKAGE__->belongs_to(
+ "item",
+ "Koha::Schema::Result::Item",
+ { itemnumber => "itemnumber" },
+ {
+ is_deferrable => 1,
+ join_type => "LEFT",
+ on_delete => "CASCADE",
+ on_update => "CASCADE",
+ },
+);
+
+__PACKAGE__->belongs_to(
+ "biblio",
+ "Koha::Schema::Result::Biblio",
+ { biblionumber => "biblionumber" },
+ {
+ is_deferrable => 1,
+ join_type => "LEFT",
+ on_delete => "CASCADE",
+ on_update => "CASCADE",
+ },
+);
-# You can replace this text with custom content, and it will be preserved on regeneration
1;
diff --git a/circ/circulation.pl b/circ/circulation.pl
index 91851d2df3..81737ee8e1 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -42,6 +42,7 @@ use CGI::Session;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
use Koha::DateUtils;
+use Koha::Database;
use Date::Calc qw(
Today
@@ -96,14 +97,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
my $branches = GetBranches();
-my @failedrenews = $query->param('failedrenew'); # expected to be itemnumbers
-our %renew_failed = ();
-for (@failedrenews) { $renew_failed{$_} = 1; }
-
-my @failedreturns = $query->param('failedreturn');
-our %return_failed = ();
-for (@failedreturns) { $return_failed{$_} = 1; }
-
my $findborrower = $query->param('findborrower') || q{};
$findborrower =~ s|,| |g;
my $borrowernumber = $query->param('borrowernumber');
@@ -121,10 +114,6 @@ if (C4::Context->preference("DisplayClearScreenButton")) {
$template->param(DisplayClearScreenButton => 1);
}
-if (C4::Context->preference("UseTablesortForCirc")) {
- $template->param(UseTablesortForCirc => 1);
-}
-
my $barcode = $query->param('barcode') || q{};
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
@@ -360,9 +349,8 @@ if ($barcode) {
}
}
- # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue
- my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
- $template->param( issuecount => $issue );
+ my ( $od, $issue, $fines ) = GetMemberIssuesAndFines($borrowernumber);
+ $template->param( issuecount => $issue );
}
# reload the borrower info for the sake of reseting the flags.....
@@ -374,194 +362,13 @@ if ($borrowernumber) {
# BUILD HTML
# show all reserves of this borrower, and the position of the reservation ....
if ($borrowernumber) {
+ $template->param(
+ holds_count => Koha::Database->new()->schema()->resultset('Reserve')
+ ->count( { borrowernumber => $borrowernumber } ) );
- # new op dev
- # now we show the status of the borrower's reservations
- my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber );
- my @reservloop;
- my @WaitingReserveLoop;
-
- foreach my $num_res (@borrowerreserv) {
- my %getreserv;
- my %getWaitingReserveInfo;
- my $getiteminfo = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
- my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} );
- my ( $transfertwhen, $transfertfrom, $transfertto ) =
- GetTransfers( $num_res->{'itemnumber'} );
-
- $getreserv{waiting} = 0;
- $getreserv{transfered} = 0;
- $getreserv{nottransfered} = 0;
-
- $getreserv{reservedate} = format_date( $num_res->{'reservedate'} );
- $getreserv{reserve_id} = $num_res->{'reserve_id'};
- $getreserv{title} = $getiteminfo->{'title'};
- $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($getiteminfo->{biblionumber}), GetFrameworkCode($getiteminfo->{biblionumber}));
- $getreserv{itemtype} = $itemtypeinfo->{'description'};
- $getreserv{author} = $getiteminfo->{'author'};
- $getreserv{barcodereserv} = $getiteminfo->{'barcode'};
- $getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'};
- $getreserv{biblionumber} = $getiteminfo->{'biblionumber'};
- $getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} );
- $getreserv{suspend} = $num_res->{'suspend'};
- $getreserv{suspend_until} = $num_res->{'suspend_until'};
- # check if we have a waiting status for reservations
- if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) {
- $getreserv{color} = 'reserved';
- $getreserv{waiting} = 1;
-# genarate information displaying only waiting reserves
- $getWaitingReserveInfo{title} = $getiteminfo->{'title'};
- $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'};
- $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'};
- $getWaitingReserveInfo{author} = $getiteminfo->{'author'};
- $getWaitingReserveInfo{itemcallnumber} = $getiteminfo->{'itemcallnumber'};
- $getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} );
- $getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} );
- $getWaitingReserveInfo{waitinghere} = 1 if $num_res->{'branchcode'} eq $branch;
- }
- # check transfers with the itemnumber foud in th reservation loop
- if ($transfertwhen) {
- $getreserv{color} = 'transfered';
- $getreserv{transfered} = 1;
- $getreserv{datesent} = format_date($transfertwhen);
- $getreserv{frombranch} = GetBranchName($transfertfrom);
- } elsif ($getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'}) {
- $getreserv{nottransfered} = 1;
- $getreserv{nottransferedby} = GetBranchName( $getiteminfo->{'holdingbranch'} );
- }
-
-# if we don't have a reserv on item, we put the biblio infos and the waiting position
- if ( $getiteminfo->{'title'} eq '' ) {
- my $getbibinfo = GetBiblioData( $num_res->{'biblionumber'} );
-
- $getreserv{color} = 'inwait';
- $getreserv{title} = $getbibinfo->{'title'};
- $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($num_res->{biblionumber}), GetFrameworkCode($num_res->{biblionumber}));
- $getreserv{nottransfered} = 0;
- $getreserv{itemtype} = $itemtypeinfo->{'description'};
- $getreserv{author} = $getbibinfo->{'author'};
- $getreserv{biblionumber} = $num_res->{'biblionumber'};
- }
- $getreserv{waitingposition} = $num_res->{'priority'};
- $getreserv{expirationdate} = $num_res->{'expirationdate'};
- push( @reservloop, \%getreserv );
-
-# if we have a reserve waiting, initiate waitingreserveloop
- if ($getreserv{waiting} == 1) {
- push (@WaitingReserveLoop, \%getWaitingReserveInfo)
- }
-
- }
-
- # return result to the template
- $template->param(
- countreserv => scalar @reservloop,
- reservloop => \@reservloop ,
- WaitingReserveLoop => \@WaitingReserveLoop,
- );
$template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
}
-# make the issued books table.
-my $todaysissues = '';
-my $previssues = '';
-our @todaysissues = ();
-our @previousissues = ();
-our @relissues = ();
-our @relprevissues = ();
-my $displayrelissues;
-
-our $totalprice = 0;
-
-sub build_issue_data {
- my $issueslist = shift;
- my $relatives = shift;
-
- # split in 2 arrays for today & previous
- foreach my $it ( @$issueslist ) {
- my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} );
-
- # set itemtype per item-level_itype syspref - FIXME this is an ugly hack
- $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'};
-
- ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges(
- $it->{'itemnumber'}, $it->{'borrowernumber'}
- );
- $it->{'charge'} = sprintf("%.2f", $it->{'charge'}) if defined $it->{'charge'};
- my ($can_renew, $can_renew_error) = CanBookBeRenewed(
- $it->{'borrowernumber'},$it->{'itemnumber'}
- );
- $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
- my $restype = C4::Reserves::GetReserveStatus( $it->{'itemnumber'} );
- $it->{'can_renew'} = $can_renew;
- $it->{'can_confirm'} = !$can_renew && !$restype;
- $it->{'renew_error'} = ( $restype eq "Waiting" or $restype eq "Reserved" ) ? 1 : 0;
- $it->{'checkoutdate'} = C4::Dates->new($it->{'issuedate'},'iso')->output('syspref');
- $it->{'issuingbranchname'} = GetBranchName($it->{'branchcode'});
-
- $totalprice += $it->{'replacementprice'} || 0;
- $it->{'itemtype'} = $itemtypeinfo->{'description'};
- $it->{'itemtype_image'} = $itemtypeinfo->{'imageurl'};
- $it->{'dd_sort'} = $it->{'date_due'};
- $it->{'dd'} = output_pref($it->{'date_due'});
- $it->{'displaydate_sort'} = $it->{'issuedate'};
- $it->{'displaydate'} = output_pref($it->{'issuedate'});
- #$it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ;
- $it->{'od'} = $it->{'overdue'};
- $it->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($it->{biblionumber}), GetFrameworkCode($it->{biblionumber}));
- $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}};
- $it->{'return_failed'} = $return_failed{$it->{'barcode'}};
-
- if ( ( $it->{'issuedate'} && $it->{'issuedate'} gt $todaysdate )
- || ( $it->{'lastreneweddate'} && $it->{'lastreneweddate'} gt $todaysdate ) ) {
- (!$relatives) ? push @todaysissues, $it : push @relissues, $it;
- } else {
- (!$relatives) ? push @previousissues, $it : push @relprevissues, $it;
- }
- ($it->{'renewcount'},$it->{'renewsallowed'},$it->{'renewsleft'}) = C4::Circulation::GetRenewCount($it->{'borrowernumber'},$it->{'itemnumber'}); #Add renewal count to item data display
-
- $it->{'soonestrenewdate'} = output_pref(
- C4::Circulation::GetSoonestRenewDate(
- $it->{borrowernumber}, $it->{itemnumber}
- )
- );
- }
-}
-
-if ($borrower) {
-
- # Getting borrower relatives
- my @relborrowernumbers = GetMemberRelatives($borrower->{'borrowernumber'});
- #push @borrowernumbers, $borrower->{'borrowernumber'};
-
- # get each issue of the borrower & separate them in todayissues & previous issues
- my $issueslist = GetPendingIssues($borrower->{'borrowernumber'});
- my $relissueslist = [];
- if ( @relborrowernumbers ) {
- $relissueslist = GetPendingIssues(@relborrowernumbers);
- }
-
- build_issue_data($issueslist, 0);
- build_issue_data($relissueslist, 1);
-
- $displayrelissues = scalar($relissueslist);
-
- if ( C4::Context->preference( "todaysIssuesDefaultSortOrder" ) eq 'asc' ) {
- @todaysissues = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues;
- }
- else {
- @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues;
- }
-
- if ( C4::Context->preference( "previousIssuesDefaultSortOrder" ) eq 'asc' ){
- @previousissues = sort { $a->{'date_due'} cmp $b->{'date_due'} } @previousissues;
- }
- else {
- @previousissues = sort { $b->{'date_due'} cmp $a->{'date_due'} } @previousissues;
- }
-}
-
-
my @values;
my %labels;
my $CGIselectborrower;
@@ -694,6 +501,11 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
);
}
+my @relatives = GetMemberRelatives( $borrower->{'borrowernumber'} );
+my $relatives_issues_count =
+ Koha::Database->new()->schema()->resultset('Issue')
+ ->count( { borrowernumber => \@relatives } );
+
$template->param(
lib_messages_loop => $lib_messages_loop,
bor_messages_loop => $bor_messages_loop,
@@ -731,13 +543,7 @@ $template->param(
duedatespec => $duedatespec,
message => $message,
CGIselectborrower => $CGIselectborrower,
- totalprice => sprintf('%.2f', $totalprice),
totaldue => sprintf('%.2f', $total),
- todayissues => \@todaysissues,
- previssues => \@previousissues,
- relissues => \@relissues,
- relprevissues => \@relprevissues,
- displayrelissues => $displayrelissues,
inprocess => $inprocess,
is_child => ($borrowernumber && $borrower->{'category_type'} eq 'C'),
circview => 1,
@@ -748,6 +554,8 @@ $template->param(
SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
RoutingSerials => C4::Context->preference('RoutingSerials'),
+ relatives_issues_count => $relatives_issues_count,
+ relatives_borrowernumbers => \@relatives,
);
# save stickyduedate to session
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index d41ef74be1..ed427eaee9 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -428,7 +428,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','YesNo'),
('UseKohaPlugins','0','','Enable or disable the ability to use Koha Plugins.','YesNo'),
('UseQueryParser','0',NULL,'If enabled, try to use QueryParser for queries.','YesNo'),
-('UseTablesortForCirc','0','','If on, use the JQuery tablesort function on the list of current borrower checkouts on the circulation page. Note that the use of this function may slow down circ for patrons with may checkouts.','YesNo'),
('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'),
('viewLabeledMARC','0','','Allow display of labeled MARC view of bibiographic records','YesNo'),
diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.dataTables.rowGrouping.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.dataTables.rowGrouping.js
new file mode 100644
index 0000000000..126ff63357
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.dataTables.rowGrouping.js
@@ -0,0 +1,690 @@
+/*
+* File: jquery.dataTables.grouping.js
+* Version: 1.2.9.
+* Author: Jovan Popovic
+*
+* Copyright 2013 Jovan Popovic, all rights reserved.
+*
+* This source file is free software, under either the GPL v2 license or a
+* BSD style license, as supplied with this software.
+*
+* This source file 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.
+* Parameters:
+* @iGroupingColumnIndex Integer Index of the column that will be used for grouping - default 0
+* @sGroupingColumnSortDirection Enumeration Sort direction of the group
+* @iGroupingOrderByColumnIndex Integer Index of the column that will be used for ordering groups
+* @sGroupingClass String Class that will be associated to the group row. Default - "group"
+* @sGroupItemClass String Class that will be associated to the group row of group items. Default - "group-item"
+* @bSetGroupingClassOnTR Boolean If set class will be set to the TR instead of the TD withing the grouping TR
+* @bHideGroupingColumn Boolean Hide column used for grouping once results are grouped. Default - true
+* @bHideGroupingOrderByColumn Boolean Hide column used for ordering groups once results are grouped. Default - true
+* @sGroupBy Enumeration Type of grouping that should be applied. Values "name"(default), "letter", "year"
+* @sGroupLabelPrefix String Prefix that will be added to each group cell
+* @bExpandableGrouping Boolean Attach expand/collapse handlers to the grouping rows
+* @bExpandSingleGroup Boolean Use accordon grouping
+* @iExpandGroupOffset Integer Number of pixels to set scroll position above the currently selected group. If -1 scroll will be alligned to the table
+* General settings
+* @sDateFormat: "dd/MM/yyyy" String Date format used for grouping
+* @sEmptyGroupLabel String Lable that will be placed as group if grouping cells are empty. Default "-"
+
+* Parameters used in the second level grouping
+* @iGroupingColumnIndex2 Integer Index of the secondary column that will be used for grouping - default 0
+* @sGroupingColumnSortDirection2 Enumeration Sort direction of the secondary group
+* @iGroupingOrderByColumnIndex2 Integer Index of the column that will be used for ordering secondary groups
+* @sGroupingClass2 String Class that will be associated to the secondary group row. Default "subgroup"
+* @sGroupItemClass2 String Class that will be associated to the secondary group row of group items. Default "subgroup-item"
+* @bHideGroupingColumn2 Boolean Hide column used for secondary grouping once results are grouped. Default - true,
+* @bHideGroupingOrderByColumn2 Boolean Hide column used for ordering secondary groups once results are grouped. Default - true,
+* @sGroupBy2 Enumeration Type of grouping that should be applied to secondary column. Values "name"(default), "letter", "year",
+* @sGroupLabelPrefix2 String Prefix that will be added to each secondary group cell
+* @fnOnGrouped Function Function that is called when grouping is finished. Function has no parameters.
+*/
+(function ($) {
+
+ "use strict";
+
+ $.fn.rowGrouping = function (options) {
+
+ function _fnOnGrouped() {
+
+ }
+
+ function _fnOnGroupCreated(oGroup, sGroup, iLevel) {
+ ///
");
+
+ params = {
+ itemnumber: itemnumber,
+ borrowernumber: borrowernumber,
+ branchcode: branchcode,
+ exempt_fine: $("#exemptfine").is(':checked')
+ };
+
+ $.post( "/cgi-bin/koha/svc/checkin.pl", params, function( data ) {
+ id = "#checkin_" + data.itemnumber;
+
+ content = "";
+ if ( data.returned ) {
+ content = CIRCULATION_RETURNED;
+ } else {
+ content = CIRCULATION_NOT_RETURNED;
+ }
+
+ $(id).replaceWith( content );
+ }, "json")
+ });
+
+ $(".renew:checked:visible").each(function() {
+ var override_limit = $("#override_limit").is(':checked') ? 1 : 0;
+
+ var itemnumber = $(this).val();
+
+ $(this).parent().parent().replaceWith("
");
+
+ var params = {
+ itemnumber: itemnumber,
+ borrowernumber: borrowernumber,
+ branchcode: branchcode,
+ override_limit: override_limit,
+ date_due: $("#newduedate").val()
+ };
+
+ $.post( "/cgi-bin/koha/svc/renew.pl", params, function( data ) {
+ var id = "#renew_" + data.itemnumber;
+
+ var content = "";
+ if ( data.renew_okay ) {
+ content = CIRCULATION_RENEWED_DUE + " " + data.date_due;
+ } else {
+ content = CIRCULATION_RENEW_FAILED + " ";
+ if ( data.error == "no_checkout" ) {
+ content += NOT_CHECKED_OUT;
+ } else if ( data.error == "too_many" ) {
+ content += TOO_MANY_RENEWALS;
+ } else if ( data.error == "on_reserve" ) {
+ content += ON_RESERVE;
+ } else if ( data.error ) {
+ content += data.error;
+ } else {
+ content += REASON_UNKNOWN;
+ }
+ }
+
+ $(id).replaceWith( content );
+ }, "json")
+ });
+
+ // Prevent form submit
+ return false;
+ });
+
+ $("#RenewAll").on("click",function(){
+ $("#CheckAllRenewals").click();
+ $("#UncheckAllCheckins").click();
+ $("#RenewCheckinChecked").click();
+
+ // Prevent form submit
+ return false;
+ });
+
+ var ymd = $.datepicker.formatDate('yy-mm-dd', new Date());
+
+ var issuesTable;
+ var drawn = 0;
+ issuesTable = $("#issues-table").dataTable({
+ "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
+ "aaSorting": [[ 0, "desc" ]],
+ "aoColumns": [
+ {
+ "mDataProp": function( oObj ) {
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ return "" + TODAYS_CHECKOUTS + "";
+ } else {
+ return "" + PREVIOUS_CHECKOUTS + "";
+ }
+ }
+ },
+ {
+ "mDataProp": "date_due",
+ "bVisible": false,
+ },
+ {
+ "iDataSort": 1, // Sort on hidden unformatted date due column
+ "mDataProp": function( oObj ) {
+ var today = new Date();
+ var due = new Date( oObj.date_due );
+ if ( today > due ) {
+ return "" + oObj.date_due_formatted + "";
+ } else {
+ return oObj.date_due_formatted;
+ }
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ title = ""
+ + oObj.title;
+
+ $.each(oObj.subtitle, function( index, value ) {
+ title += " " + value.subfield;
+ });
+
+ title += "";
+
+ if ( oObj.author ) {
+ title += " " + BY + " " + oObj.author;
+ }
+
+ if ( oObj.itemnotes ) {
+ var span_class = "";
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ span_class = "circ-hlt";
+ }
+ title += " - " + oObj.itemnotes + ""
+ }
+
+ title += " "
+ + ""
+ + oObj.barcode
+ + "";
+
+ return title;
+ }
+ },
+ { "mDataProp": "itemtype" },
+ { "mDataProp": "issuedate" },
+ { "mDataProp": "branchname" },
+ { "mDataProp": "itemcallnumber" },
+ {
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ return parseFloat(oObj.charge).toFixed(2);
+ }
+ },
+ {
+ "bSortable": false,
+ "mDataProp": "price" },
+ {
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ var content = "";
+ var span_style = "";
+ var span_class = "";
+
+ content += "";
+ content += "" + oObj.renewals_count + "";
+
+ if ( oObj.can_renew ) {
+ // Do nothing
+ } else if ( oObj.can_renew_error == "on_reserve" ) {
+ content += ""
+ + "" + ON_HOLD + ""
+ + "";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ } else if ( oObj.can_renew_error == "too_many" ) {
+ content += ""
+ + NOT_RENEWABLE
+ + "";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ } else {
+ content += ""
+ + oObj.can_renew_error
+ + "";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ }
+
+ content += ""
+ + ""
+ + "";
+
+ if ( oObj.renewals_remaining ) {
+ content += "("
+ + oObj.renewals_remaining
+ + " " + OF + " "
+ + oObj.renewals_allowed + " "
+ + RENEWALS_REMAINING + ")";
+ }
+
+ content += "";
+
+
+ return content;
+ }
+ },
+ {
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ if ( oObj.can_renew_error == "on_reserve" ) {
+ return "" + ON_HOLD + "";
+ } else {
+ return "";
+ }
+ }
+ },
+ {
+ "bVisible": exports_enabled ? true : false,
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ return "";
+ }
+ }
+ ],
+ "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
+ var total_charge = 0;
+ var total_price = 0;
+ for ( var i=0; i < aaData.length; i++ ) {
+ total_charge += aaData[i]['charge'] * 1;
+ total_price += aaData[i]['price'] * 1;
+ }
+ var nCells = nRow.getElementsByTagName('td');
+ nCells[1].innerHTML = total_charge.toFixed(2);
+ nCells[2].innerHTML = total_price.toFixed(2);
+ },
+ "bPaginate": false,
+ "bProcessing": true,
+ "bServerSide": false,
+ "sAjaxSource": '/cgi-bin/koha/svc/checkouts.pl',
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
+
+ $.getJSON( sSource, aoData, function (json) {
+ fnCallback(json)
+ } );
+ },
+ "fnInitComplete": function(oSettings) {
+ // Disable rowGrouping plugin after first use
+ // so any sorting on the table doesn't use it
+ var oSettings = issuesTable.fnSettings();
+
+ for (f = 0; f < oSettings.aoDrawCallback.length; f++) {
+ if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') {
+ oSettings.aoDrawCallback.splice(f, 1);
+ break;
+ }
+ }
+
+ oSettings.aaSortingFixed = null;
+ },
+ }).rowGrouping(
+ {
+ iGroupingOrderByColumnIndex: 0,
+ sGroupingColumnSortDirection: "desc"
+ }
+ );
+
+ if ( $("#issues-table").length ) {
+ $("#issues-table_processing").position({
+ of: $( "#issues-table" ),
+ collision: "none"
+ });
+ }
+
+ // Don't load relatives' issues table unless it is clicked on
+ var relativesIssuesTable;
+ $("#relatives-issues-tab").click( function() {
+ if ( ! relativesIssuesTable ) {
+ relativesIssuesTable = $("#relatives-issues-table").dataTable({
+ "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
+ "aaSorting": [],
+ "aoColumns": [
+ {
+ "mDataProp": function( oObj ) {
+ var today = new Date();
+ var due = new Date( oObj.date_due );
+ if ( today > due ) {
+ return "" + oObj.date_due_formatted + "";
+ } else {
+ return oObj.date_due_formatted;
+ }
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ title = ""
+ + oObj.title;
+
+ $.each(oObj.subtitle, function( index, value ) {
+ title += " " + value.subfield;
+ });
+
+ title += "";
+
+ if ( oObj.author ) {
+ title += " " + BY + " " + oObj.author;
+ }
+
+ if ( oObj.itemnotes ) {
+ var span_class = "";
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ span_class = "circ-hlt";
+ }
+ title += " - " + oObj.itemnotes + ""
+ }
+
+ title += " "
+ + ""
+ + oObj.barcode
+ + "";
+
+ return title;
+ }
+ },
+ { "mDataProp": "itemtype" },
+ { "mDataProp": "issuedate" },
+ { "mDataProp": "branchname" },
+ { "mDataProp": "itemcallnumber" },
+ { "mDataProp": "charge" },
+ { "mDataProp": "price" },
+ {
+ "mDataProp": function( oObj ) {
+ return ""
+ + oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")"
+ }
+ },
+ ],
+ "bPaginate": false,
+ "bProcessing": true,
+ "bServerSide": true,
+ "sAjaxSource": '/cgi-bin/koha/svc/checkouts.pl',
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ $.each(relatives_borrowernumbers, function( index, value ) {
+ aoData.push( { "name": "borrowernumber", "value": value } );
+ });
+
+ $.getJSON( sSource, aoData, function (json) {
+ fnCallback(json)
+ } );
+ },
+ });
+ }
+ });
+
+ if ( $("#relatives-issues-table").length ) {
+ $("#relatives-issues-table_processing").position({
+ of: $( "#relatives-issues-table" ),
+ collision: "none"
+ });
+ }
+
+ if ( AllowRenewalLimitOverride ) {
+ $( '#override_limit' ).click( function () {
+ if ( this.checked ) {
+ $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
+ } else {
+ $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
+ }
+ } ).attr( 'checked', false );
+ }
+ });
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js
new file mode 100644
index 0000000000..76dfee55fc
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js
@@ -0,0 +1,133 @@
+$(document).ready(function() {
+ // Don't load holds table unless it is clicked on
+ var holdsTable;
+ $("#holds-tab").click( function() {
+ if ( ! holdsTable ) {
+ holdsTable = $("#holds-table").dataTable({
+ "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
+ "aoColumns": [
+ {
+ "mDataProp": "reservedate_formatted"
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ title = ""
+ + oObj.title;
+
+ $.each(oObj.subtitle, function( index, value ) {
+ title += " " + value.subfield;
+ });
+
+ title += "";
+
+ if ( oObj.author ) {
+ title += " " + BY + " " + oObj.author;
+ }
+
+ if ( oObj.itemnotes ) {
+ var span_class = "";
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ span_class = "circ-hlt";
+ }
+ title += " - " + oObj.itemnotes + ""
+ }
+
+ title += " "
+ + ""
+ + oObj.barcode
+ + "";
+
+ return title;
+ }
+ },
+ {
+ "mDataProp": function( oObj ) {
+ return oObj.itemcallnumber || "";
+ }
+ },
+ {
+ "mDataProp": function( oObj ) {
+ var data = "";
+
+ if ( oObj.suspend == 1 ) {
+ data += "" + HOLD_IS + " " + SUSPENDED + " "; + if ( oObj.suspend_until ) { + data += " " + UNTIL + " " + oObj.suspend_until_formatted; + } + data += "
"; + } + + if ( oObj.barcode ) { + data += ""; + if ( oObj.found == "W" ) { + data += ITEM_IS + " " + WAITING + " "; + + if ( ! oObj.waiting_here ) { + data += " " + AT + " " + oObj.waiting_at; + } + } else if ( oObj.transferred ) { + data += ITEM_IS + " " + IN_TRANSIT + " " + FROM + oObj.from_branch; + } else if ( oObj.not_transferred ) { + data += NOT_TRANSFERRED_YET + " " + oObj.not_transferred_by; + } data += ""; + + data += " " + oObj.barcode + ""; + } + + return data; + } + }, + { "mDataProp": "expirationdate_formatted" }, + { + "mDataProp": function( oObj ) { + if ( oObj.priority && parseInt( oObj.priority ) && parseInt( oObj.priority ) > 0 ) { + return oObj.priority; + } else { + return ""; + } + } + }, + { + "mDataProp": function( oObj ) { + return "" + + "" + + "" + + ""; + } + } + ], + "bPaginate": false, + "bProcessing": true, + "bServerSide": true, + "sAjaxSource": '/cgi-bin/koha/svc/holds.pl', + "fnServerData": function ( sSource, aoData, fnCallback ) { + aoData.push( { "name": "borrowernumber", "value": borrowernumber } ); + + $.getJSON( sSource, aoData, function (json) { + fnCallback(json) + } ); + }, + }); + + if ( $("#holds-table").length ) { + $("#holds-table_processing").position({ + of: $( "#holds-table" ), + collision: "none" + }); + } + } + }); + +}); diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js index fe307bf22f..489403f10a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js @@ -1,57 +1,22 @@ $(document).ready(function() { + $("#CheckAllExports").on("click",function(){ + $(".export:visible").attr("checked", "checked" ); + return false; + }); + $("#UncheckAllExports").on("click",function(){ + $(".export:visible").removeAttr("checked"); + return false; + }); + $('#patronlists').tabs(); - var allcheckboxes = $(".checkboxed"); - $("#renew_all").on("click",function(){ - allcheckboxes.checkCheckboxes(":input[name*=items]"); - allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); - }); - $("#CheckAllitems").on("click",function(){ - allcheckboxes.checkCheckboxes(":input[name*=items]"); - allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; - }); - $("#CheckNoitems").on("click",function(){ - allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; - }); - $("#CheckAllreturns").on("click",function(){ - allcheckboxes.checkCheckboxes(":input[name*=barcodes]"); - allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; - }); - $("#CheckNoreturns" ).on("click",function(){ - allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; - }); - $("#CheckAllexports").on("click",function(){ - allcheckboxes.checkCheckboxes(":input[name*=biblionumbers]"); - return false; - }); - $("#CheckNoexports").on("click",function(){ - allcheckboxes.unCheckCheckboxes(":input[name*=biblionumbers]"); - return false; - }); - - $("#relrenew_all").on("click",function(){ - allcheckboxes.checkCheckboxes(":input[name*=items]"); - allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); - }); - $("#relCheckAllitems").on("click",function(){ - allcheckboxes.checkCheckboxes(":input[name*=items]"); - allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; - }); - $("#relCheckNoitems").on("click",function(){ - allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; - }); - $("#relCheckAllreturns").on("click",function(){ - allcheckboxes.checkCheckboxes(":input[name*=barcodes]"); - allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; - }); - $("#relCheckNoreturns").on("click",function(){ - allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; - }); $("#messages ul").after(""+MSG_ADD_MESSAGE+""); + $("#borrower_messages .cancel").on("click",function(){ $("#add_message_form").hide(); $("#addmessage").show(); }); + $("#addmessage").on("click",function(){ $(this).hide(); $("#add_message_form").show(); @@ -76,14 +41,7 @@ $(document).ready(function() { export_checkouts(export_format); return false; }); - // Clicking the table cell checks the checkbox inside it - $("td").on("click",function(e){ - if(e.target.tagName.toLowerCase() == 'td'){ - $(this).find("input:checkbox:visible").each( function() { - $(this).click(); - }); - } - }); + }); function export_checkouts(format) { @@ -107,13 +65,9 @@ function export_checkouts(format) { } else if (format == 'iso2709') { $("#dont_export_item").val(1); } - document.issues.action="/cgi-bin/koha/tools/export.pl"; + document.getElementById("export_format").value = format; document.issues.submit(); - - /* Reset form action to its initial value */ - document.issues.action="/cgi-bin/koha/reserve/renewscript.pl"; - } function validate1(date) { @@ -124,10 +78,3 @@ function validate1(date) { return false; } } - -// prevent adjacent checkboxes from being checked simultaneously -function radioCheckBox(box){ - box.parents("td").siblings().find("input:checkbox.radio").each(function(){ - $(this).removeAttr("checked"); - }); - } 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 5a768a6682..55d8a7852e 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 @@ -39,12 +39,6 @@ Circulation: asc: earliest to latest desc: latest to earliest - due date. - - - - pref: UseTablesortForCirc - choices: - yes: "Enable" - no: "Don't enable" - - "the sorting of current patron checkouts on the circulation screen.Patron has nothing checked out.
+| Due date | +Title | +Item type | +Checked out on | +Checked out from | +Call no | +Charge | +Price | +Patron | +
|---|
| Due date | -Title | -Item type | -Checked out on | -Checked out from | -Call no | -Charge | -Price | -Patron | -||
|---|---|---|---|---|---|---|---|---|---|---|
| [% ELSE %] | [% END %] - [% relissue.dd %] | - - [% IF ( relissue.itemlost ) %] - [% AuthorisedValues.GetByCode( 'LOST', relissue.itemlost ) %] - [% END %] - [% IF ( relissue.damaged ) %] - [% AuthorisedValues.GetByCode( 'DAMAGED', relissue.damaged ) %] - [% END %] - -[% relissue.title |html %][% FOREACH subtitl IN relissue.subtitle %] [% subtitl.subfield %][% END %][% IF ( relissue.author ) %], by [% relissue.author %][% END %][% IF ( relissue.itemnotes ) %]- [% relissue.itemnotes %][% END %] [% relissue.barcode %] | -[% UNLESS ( noItemTypeImages ) %] [% IF ( relissue.itemtype_image ) %] |
- [% relissue.displaydate %] | -[% relissue.issuingbranchname %] | -[% relissue.itemcallnumber %] | -[% relissue.charge %] | -[% relissue.replacementprice %] | [% relissue.firstname %] [% relissue.surname %] ([% relissue.cardnumber %]) | -|
| Previous checkouts | ||||||||||
| Previous checkouts | ||||||||||
| [% ELSE %] | [% END %] - [% relprevissue.dd %] - | -[% relprevissue.title |html %][% FOREACH subtitl IN relprevissue.subtitle %] [% subtitl.subfield %][% END %][% IF ( relprevissue.author ) %], by [% relprevissue.author %][% END %] [% IF ( relprevissue.itemnotes ) %]- [% relprevissue.itemnotes %][% END %] [% relprevissue.barcode %] | -[% UNLESS noItemTypeImages %][% IF relprevissue.itemtype_image %] |
- [% relprevissue.displaydate %] | -[% relprevissue.issuingbranchname %] | -[% relprevissue.itemcallnumber %] | - [% IF ( relprevissue.multiple_borrowers ) %][% relprevissue.firstname %] [% relprevissue.surname %] | [% END %] -[% relprevissue.charge %] | -[% relprevissue.replacementprice %] | -[% relprevissue.firstname %] [% relprevissue.surname %] ([% relprevissue.cardnumber %]) | - -
");
+
+ params = {
+ itemnumber: itemnumber,
+ borrowernumber: borrowernumber,
+ branchcode: branchcode,
+ exempt_fine: $("#exemptfine").is(':checked')
+ };
+
+ $.post( "/cgi-bin/koha/svc/checkin.pl", params, function( data ) {
+ id = "#checkin_" + data.itemnumber;
+
+ content = "";
+ if ( data.returned ) {
+ content = CIRCULATION_RETURNED;
+ } else {
+ content = CIRCULATION_NOT_RETURNED;
+ }
+
+ $(id).replaceWith( content );
+ }, "json")
+ });
+
+ $(".renew:checked:visible").each(function() {
+ var override_limit = $("#override_limit").is(':checked') ? 1 : 0;
+
+ var itemnumber = $(this).val();
+
+ $(this).parent().parent().replaceWith("
");
+
+ var params = {
+ itemnumber: itemnumber,
+ borrowernumber: borrowernumber,
+ branchcode: branchcode,
+ override_limit: override_limit,
+ date_due: $("#newduedate").val()
+ };
+
+ $.post( "/cgi-bin/koha/svc/renew.pl", params, function( data ) {
+ var id = "#renew_" + data.itemnumber;
+
+ var content = "";
+ if ( data.renew_okay ) {
+ content = CIRCULATION_RENEWED_DUE + " " + data.date_due;
+ } else {
+ content = CIRCULATION_RENEW_FAILED + " ";
+ if ( data.error == "no_checkout" ) {
+ content += NOT_CHECKED_OUT;
+ } else if ( data.error == "too_many" ) {
+ content += TOO_MANY_RENEWALS;
+ } else if ( data.error == "on_reserve" ) {
+ content += ON_RESERVE;
+ } else if ( data.error ) {
+ content += data.error;
+ } else {
+ content += REASON_UNKNOWN;
+ }
+ }
+
+ $(id).replaceWith( content );
+ }, "json")
+ });
+
+ // Prevent form submit
+ return false;
+ });
+
+ $("#RenewAll").on("click",function(){
+ $("#CheckAllRenewals").click();
+ $("#UncheckAllCheckins").click();
+ $("#RenewCheckinChecked").click();
+
+ // Prevent form submit
+ return false;
+ });
+
+ var ymd = $.datepicker.formatDate('yy-mm-dd', new Date());
+
+ var issuesTable;
+ var drawn = 0;
+ issuesTable = $("#issues-table").dataTable({
+ "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
+ "aaSorting": [[ 0, "desc" ]],
+ "aoColumns": [
+ {
+ "mDataProp": function( oObj ) {
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ return "" + TODAYS_CHECKOUTS + "";
+ } else {
+ return "" + PREVIOUS_CHECKOUTS + "";
+ }
+ }
+ },
+ {
+ "mDataProp": "date_due",
+ "bVisible": false,
+ },
+ {
+ "iDataSort": 1, // Sort on hidden unformatted date due column
+ "mDataProp": function( oObj ) {
+ var today = new Date();
+ var due = new Date( oObj.date_due );
+ if ( today > due ) {
+ return "" + oObj.date_due_formatted + "";
+ } else {
+ return oObj.date_due_formatted;
+ }
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ title = ""
+ + oObj.title;
+
+ $.each(oObj.subtitle, function( index, value ) {
+ title += " " + value.subfield;
+ });
+
+ title += "";
+
+ if ( oObj.author ) {
+ title += " " + BY + " " + oObj.author;
+ }
+
+ if ( oObj.itemnotes ) {
+ var span_class = "";
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ span_class = "circ-hlt";
+ }
+ title += " - " + oObj.itemnotes + ""
+ }
+
+ title += " "
+ + ""
+ + oObj.barcode
+ + "";
+
+ return title;
+ }
+ },
+ { "mDataProp": "itemtype" },
+ { "mDataProp": "issuedate" },
+ { "mDataProp": "branchname" },
+ { "mDataProp": "itemcallnumber" },
+ {
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ return parseFloat(oObj.charge).toFixed(2);
+ }
+ },
+ {
+ "bSortable": false,
+ "mDataProp": "price" },
+ {
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ var content = "";
+ var span_style = "";
+ var span_class = "";
+
+ content += "";
+ content += "" + oObj.renewals_count + "";
+
+ if ( oObj.can_renew ) {
+ // Do nothing
+ } else if ( oObj.can_renew_error == "on_reserve" ) {
+ content += ""
+ + "" + ON_HOLD + ""
+ + "";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ } else if ( oObj.can_renew_error == "too_many" ) {
+ content += ""
+ + NOT_RENEWABLE
+ + "";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ } else {
+ content += ""
+ + oObj.can_renew_error
+ + "";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ }
+
+ content += ""
+ + ""
+ + "";
+
+ if ( oObj.renewals_remaining ) {
+ content += "("
+ + oObj.renewals_remaining
+ + " " + OF + " "
+ + oObj.renewals_allowed + " "
+ + RENEWALS_REMAINING + ")";
+ }
+
+ content += "";
+
+
+ return content;
+ }
+ },
+ {
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ if ( oObj.can_renew_error == "on_reserve" ) {
+ return "" + ON_HOLD + "";
+ } else {
+ return "";
+ }
+ }
+ },
+ {
+ "bVisible": exports_enabled ? true : false,
+ "bSortable": false,
+ "mDataProp": function ( oObj ) {
+ return "";
+ }
+ }
+ ],
+ "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
+ var total_charge = 0;
+ var total_price = 0;
+ for ( var i=0; i < aaData.length; i++ ) {
+ total_charge += aaData[i]['charge'] * 1;
+ total_price += aaData[i]['price'] * 1;
+ }
+ var nCells = nRow.getElementsByTagName('td');
+ nCells[1].innerHTML = total_charge.toFixed(2);
+ nCells[2].innerHTML = total_price.toFixed(2);
+ },
+ "bPaginate": false,
+ "bProcessing": true,
+ "bServerSide": false,
+ "sAjaxSource": '/cgi-bin/koha/svc/checkouts.pl',
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
+
+ $.getJSON( sSource, aoData, function (json) {
+ fnCallback(json)
+ } );
+ },
+ "fnInitComplete": function(oSettings) {
+ // Disable rowGrouping plugin after first use
+ // so any sorting on the table doesn't use it
+ var oSettings = issuesTable.fnSettings();
+
+ for (f = 0; f < oSettings.aoDrawCallback.length; f++) {
+ if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') {
+ oSettings.aoDrawCallback.splice(f, 1);
+ break;
+ }
+ }
+
+ oSettings.aaSortingFixed = null;
+ },
+ }).rowGrouping(
+ {
+ iGroupingOrderByColumnIndex: 0,
+ sGroupingColumnSortDirection: "desc"
+ }
+ );
+
+ if ( $("#issues-table").length ) {
+ $("#issues-table_processing").position({
+ of: $( "#issues-table" ),
+ collision: "none"
+ });
+ }
+
+ // Don't load relatives' issues table unless it is clicked on
+ var relativesIssuesTable;
+ $("#relatives-issues-tab").click( function() {
+ if ( ! relativesIssuesTable ) {
+ relativesIssuesTable = $("#relatives-issues-table").dataTable({
+ "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
+ "aaSorting": [],
+ "aoColumns": [
+ {
+ "mDataProp": function( oObj ) {
+ var today = new Date();
+ var due = new Date( oObj.date_due );
+ if ( today > due ) {
+ return "" + oObj.date_due_formatted + "";
+ } else {
+ return oObj.date_due_formatted;
+ }
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ title = ""
+ + oObj.title;
+
+ $.each(oObj.subtitle, function( index, value ) {
+ title += " " + value.subfield;
+ });
+
+ title += "";
+
+ if ( oObj.author ) {
+ title += " " + BY + " " + oObj.author;
+ }
+
+ if ( oObj.itemnotes ) {
+ var span_class = "";
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ span_class = "circ-hlt";
+ }
+ title += " - " + oObj.itemnotes + ""
+ }
+
+ title += " "
+ + ""
+ + oObj.barcode
+ + "";
+
+ return title;
+ }
+ },
+ { "mDataProp": "itemtype" },
+ { "mDataProp": "issuedate" },
+ { "mDataProp": "branchname" },
+ { "mDataProp": "itemcallnumber" },
+ { "mDataProp": "charge" },
+ { "mDataProp": "price" },
+ {
+ "mDataProp": function( oObj ) {
+ return ""
+ + oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")"
+ }
+ },
+ ],
+ "bPaginate": false,
+ "bProcessing": true,
+ "bServerSide": true,
+ "sAjaxSource": '/cgi-bin/koha/svc/checkouts.pl',
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ $.each(relatives_borrowernumbers, function( index, value ) {
+ aoData.push( { "name": "borrowernumber", "value": value } );
+ });
+
+ $.getJSON( sSource, aoData, function (json) {
+ fnCallback(json)
+ } );
+ },
+ });
+ }
+ });
+
+ if ( $("#relatives-issues-table").length ) {
+ $("#relatives-issues-table_processing").position({
+ of: $( "#relatives-issues-table" ),
+ collision: "none"
+ });
+ }
+
+ if ( AllowRenewalLimitOverride ) {
+ $( '#override_limit' ).click( function () {
+ if ( this.checked ) {
+ $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
+ } else {
+ $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
+ }
+ } ).attr( 'checked', false );
+ }
+ });
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js
new file mode 100644
index 0000000000..76dfee55fc
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js
@@ -0,0 +1,133 @@
+$(document).ready(function() {
+ // Don't load holds table unless it is clicked on
+ var holdsTable;
+ $("#holds-tab").click( function() {
+ if ( ! holdsTable ) {
+ holdsTable = $("#holds-table").dataTable({
+ "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
+ "aoColumns": [
+ {
+ "mDataProp": "reservedate_formatted"
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ title = ""
+ + oObj.title;
+
+ $.each(oObj.subtitle, function( index, value ) {
+ title += " " + value.subfield;
+ });
+
+ title += "";
+
+ if ( oObj.author ) {
+ title += " " + BY + " " + oObj.author;
+ }
+
+ if ( oObj.itemnotes ) {
+ var span_class = "";
+ if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ span_class = "circ-hlt";
+ }
+ title += " - " + oObj.itemnotes + ""
+ }
+
+ title += " "
+ + ""
+ + oObj.barcode
+ + "";
+
+ return title;
+ }
+ },
+ {
+ "mDataProp": function( oObj ) {
+ return oObj.itemcallnumber || "";
+ }
+ },
+ {
+ "mDataProp": function( oObj ) {
+ var data = "";
+
+ if ( oObj.suspend == 1 ) {
+ data += "