From: miker Date: Wed, 25 Aug 2010 21:51:55 +0000 (+0000) Subject: update standing penalty query for blocked barcode list, trunk style! X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f9198c189dab9d35ba8935a1d15f75f204852792;p=evergreen%2Ftadl.git update standing penalty query for blocked barcode list, trunk style! git-svn-id: svn://svn.open-ils.org/ILS/trunk@17339 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm index cdd11e65fe..22362cf53c 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm @@ -583,20 +583,21 @@ __PACKAGE__->register_method( sub penalized_barcodes { my $self = shift; my $client = shift; - my @ignore = @_; my $c = actor::card->table; my $p = actor::user_standing_penalty->table; - my $sql = "SELECT c.barcode FROM $c c JOIN $p p USING (usr)"; - - if (@ignore) { - $sql .= ' WHERE penalty_type NOT IN ('. join(',', map { '?' } @ignore) . ')'; - } - - $sql .= ' GROUP BY c.barcode;'; + my $sql = <<" SQL"; + SELECT DISTINCT c.barcode + FROM $c c + JOIN $p p USING (usr) + JOIN config.standing_penalty csp ON (csp.id = p.standing_penalty) + WHERE csp.block_list IS NOT NULL + AND p.set_date < CURRENT_DATE + AND (p.stop_date IS NULL OR p.stop_date > CURRENT_DATE); + SQL - my $list = actor::user->db_Main->selectcol_arrayref($sql, {}, @ignore); + my $list = actor::user->db_Main->selectcol_arrayref($sql); for my $bc ( @$list ) { $client->respond($bc); } @@ -608,11 +609,7 @@ __PACKAGE__->register_method( stream => 1, method => 'penalized_barcodes', signature => <<' NOTE', - Returns an array of barcodes that have penalties not listed - as a parameter. Supply a list of any penalty types that should - not stop a patron from checking out materials. - - @param ignore_list Penalty type to ignore + Returns an array of barcodes that have blocking penalties. @return array of barcodes NOTE );