Permalink
Browse files

Merge branch 'master' into testing

  • Loading branch information...
2 parents 80362a7 + 9a5b7d8 commit fe96b52e3ddbb51a02c72aca10ef264b1f8608bb @pjones9 pjones9 committed Aug 3, 2010
@@ -407,7 +407,7 @@ sub execute_query ($;$$$) {
if (defined($userlimit)) {
if ($offset + $limit > $userlimit ) {
$limit = $userlimit - $offset;
- } elsif ( ! $offset && $limit > $userlimit ) {
+ } elsif ( ! $offset && $limit < $userlimit ) {
$limit = $userlimit;
}
}
@@ -23,7 +23,6 @@
debug => 1,
});
-use Data::Dumper;
my $params = $input->Vars();
if ($params->{'update_settings'}) {
@@ -33,6 +32,7 @@
# rely on set_circ_exceptions to ignore the disabled ones
for my $context (keys %$circ_exceptions){
for my $code (keys %{$circ_exceptions->{$context}}){
+ $circ_exceptions->{$context}->{$code}->{'block'} = ($params->{$context.'--'.$code.'--block'}) ? 1 : 0;
$circ_exceptions->{$context}->{$code}->{'require_confirm'} = ($params->{$context.'--'.$code.'--require_confirm'}) ? 1 : 0;
$circ_exceptions->{$context}->{$code}->{'allow_override'} = ($params->{$context.'--'.$code.'--allow_override'}) ? 1 : 0;
}
View
@@ -34,6 +34,7 @@
use C4::Context;
use C4::Debug;
use CGI::Session;
+use Data::Dumper;
my $query = new CGI;
@@ -70,6 +71,11 @@
my $proxy_borrowernumber = $query->param('proxy_borrowernumber');
my $barcode = $query->param('barcode') || '';
+my $or_barcode = $query->param('or_barcode');
+if ($or_barcode && !$barcode) {
+ $barcode = $or_barcode;
+}
+
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
$barcode = barcodedecode($barcode) if( $barcode && (C4::Context->preference('itemBarcodeInputFilter') || C4::Context->preference('itembarcodelength')));
@@ -81,7 +87,6 @@
my $branch = C4::Context->userenv->{'branch'};
my $permissions = C4::Context->userenv->{'permissions'};
-use Data::Dumper;
my $borrowerslist;
my $no_patron_found;
@@ -98,6 +103,10 @@
}
my @new_overrides = ($query->param('overridden_blocks')) ? split(',',$query->param('overridden_blocks')) : ();
+my $overridden_blocks = {};
+for (@new_overrides) {
+ $overridden_blocks->{$_} = 1;
+}
# my @new_confirmed = ($query->param('confirmed_blocks')) ? split(',',$query->param('confirmed_blocks')) : ();
# manage circ_session ( certain overrides should remain valid for the duration of a 'circ session',
@@ -109,7 +118,9 @@
$debug and warn "session overrides: " . join(',',@overrides);
my $patron_exceptions = get_circ_exceptions('patron');
# FIXME : This is inefficient way to ignore overrides that shouldn't be stored in session.
-if($borrowernumber && $session->param('circ_context') && $session->param('circ_context') eq 'circulation.pl' && $session->param('circ_borrower') == $borrowernumber){
+if($borrowernumber && $session->param('circ_context')
+ && $session->param('circ_context') eq 'circulation.pl'
+ && $session->param('circ_borrower') == $borrowernumber){
# if we have new overrides, store them in session.
my $update_overrides = 0;
for my $new_or (@new_overrides) {
@@ -223,8 +234,10 @@
$exception->{'expiry'} = $expiry_date->output();
}
if($exception->{'block'}){
- unshift @$patron_block, $exception;
- push @missing_perms, $condition unless($exception->{'can_override'} || ! $exception->{'allow_override'});
+ unshift @{$patron_block}, $exception;
+ unless($exception->{'can_override'} || ! $exception->{'allow_override'}) {
+ push @missing_perms, $condition;
+ }
} else {
push @$patron_block, $exception;
}
@@ -295,6 +308,25 @@
$template->param( INVALID_DATE => $invalidduedate );
} else {
( $status, $circ_exception ) = CanBookBeIssued( $borrower, $barcode, $datedue , undef );
+ if ($status->{block}) {
+ my $still_blocked = 0;
+ foreach ( keys %{$circ_exception} ) {
+ if ($overridden_blocks->{$_}) {
+ # delete $circ_exception->{$_};
+ $circ_exception->{$_}->{overridden} = 1;
+ }
+ else {
+ $still_blocked = 1;
+ }
+ }
+ if (!$still_blocked) {
+ $status->{block} = $still_blocked;
+ $status->{can_override} = 0;
+ $status->{allow_override} = 0;
+ $status->{require_confirm} = 0;
+ }
+
+ }
}
# CIRC_BLOCK
# each array entry in CIRC_BLOCK will have keys block, allow_override, require_confirm, can_override.
@@ -363,8 +395,6 @@
##################################################################################
# BUILD HTML
# show all reserves of this borrower, and the position of the reservation ....
-my $borrowercategory;
-my $category_type;
if ($borrowernumber) {
# Patron HOLDS
@@ -427,7 +457,6 @@
my @hourlyissues;
my @todaysissues;
my @previousissues;
- my $allowborrow;
my %issuetypes;
my $renewal_permission_on_hold = circ_exception_permissions('checkout','renewal_on_hold');
my $renewal_permission_too_many = circ_exception_permissions('checkout','renewals_exceed_maxrenewals');
@@ -138,6 +138,7 @@ $.tablesorter.addParser({
$(".circ_override:checked").each(function(){ var or_str = $(this).attr('id'); overridden_blocks.push(or_str.substr(3)); });
$("#overridden_blocks").val( overridden_blocks.join(',') );
$("#circform input#barcode").val( confirm_barcode );
+ $("#or_barcode").val( confirm_barcode );
$("#circform").submit();
} else {
alert( _("Please confirm each block you wish to override") );
@@ -165,6 +166,8 @@ $.tablesorter.addParser({
function cancelCirc(){
$("#circform input#barcode").val('');
+ $("#circform or_barcode").val('');
+ $("#circform overridden_blocks").val( '' );
$("#circ_blocks").slideUp(); // TODO: test that there aren't blocks that need to be handled.
if( ! patron_block ){
toggle_circ(1);
@@ -382,11 +385,30 @@ most, but not all, of these are deprecated.
</ul>
</li>
<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="BLOCK_item_issued_to_another" -->
+ <!-- TMPL_IF NAME="block" --><li class="circ_block"><!-- TMPL_ELSE --><li class="circ_alert"><!-- /TMPL_IF -->
+ <p class="circ-hlt">Item currently checked out to <!-- TMPL_VAR NAME="info" --></p>
+ <ul>
+ <!-- TMPL_IF NAME="allow_override" -->
+ <!-- TMPL_IF NAME="can_override" -->
+ <li>
+ <label for="OR_item_issued_to_another">Override Block?</label>
+ <input type="checkbox" class="circ_override" name="OR_item_issued_to_another" id="OR_item_issued_to_another" />
+ </li>
+ <!-- TMPL_ELSE -->
+ <li>You do not have permission to override this block.</li>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ </ul>
+ </li>
+ <!-- /TMPL_IF -->
<!-- TMPL_IF NAME="ISSUED_TO_ANOTHER" --> <li>Item currently checked out to <!-- TMPL_VAR NAME="ISSUED_TO_ANOTHER" -->. Check in and check out?</li> <!-- /TMPL_IF -->
<!-- TMPL_IF NAME="PATRON_CANT" --><li>This patron can't check out this item per library circulation policy</i> <!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</ul>
+<!-- CSC TRY THIS -->
+
<div class="dialog">
<!-- TMPL_IF NAME="allow_override_circ" -->
@@ -554,6 +576,9 @@ most, but not all, of these are deprecated.
<div class="yui-g">
<div class="yui-u first"> <!-- BARCODE ENTRY -->
<form method="post" action="/cgi-bin/koha/circ/circulation.pl" name="circform" id="circform">
+ <input type="hidden" name="borrowernumber" id="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
+ <input type="hidden" name="or_barcode" id="or_barcode" value="" />
+ <input type="hidden" name="overridden_blocks" id="overridden_blocks" value="" />
<fieldset id="circ_circulation_issue">
<label for="barcode">Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)
<!-- TMPL_IF NAME="CAN_user_circulate_checkout_via_proxy" -->

0 comments on commit fe96b52

Please sign in to comment.