Bug 5786 [QA Followup]

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Kyle Hall 2014-12-19 06:27:27 -05:00 committed by Tomas Cohen Arazi
parent 1802aa9153
commit ebccf4099f
4 changed files with 55 additions and 18 deletions

View file

@ -1545,7 +1545,7 @@ sub IsAvailableForItemLevelRequest {
$notforloan_per_itemtype ||
$item->{itemlost} ||
$item->{notforloan} > 0 ||
$item->{wthdrawn} ||
$item->{withdrawn} ||
($item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems'));

View file

@ -161,6 +161,19 @@ __PACKAGE__->table("issuingrules");
is_nullable: 1
size: [28,6]
=head2 onshelfholds
data_type: 'tinyint'
default_value: 0
is_nullable: 0
=head2 opacitemholds
data_type: 'char'
default_value: 'N'
is_nullable: 0
size: 1
=cut
__PACKAGE__->add_columns(
@ -217,6 +230,10 @@ __PACKAGE__->add_columns(
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
"overduefinescap",
{ data_type => "decimal", is_nullable => 1, size => [28, 6] },
"onshelfholds",
{ data_type => "tinyint", default_value => 0, is_nullable => 0 },
"opacitemholds",
{ data_type => "char", default_value => "N", is_nullable => 0, size => 1 },
);
=head1 PRIMARY KEY
@ -236,8 +253,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-09-17 21:06:58
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vmlv13CeQ99RO0VsviRABg
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2014-12-19 07:00:40
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CE8yuYC5QgPHI2GOjiT28w
# You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -27,6 +27,7 @@ use C4::Koha;
use C4::Debug;
use C4::Branch; # GetBranches
use C4::Dates qw/format_date format_date_in_iso/;
use Koha::Database;
my $input = CGI->new;
my $dbh = C4::Context->dbh;
@ -100,10 +101,6 @@ 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, norenewalbefore, auto_renew, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, maxsuspensiondays, firstremind, chargeperiod,rentaldiscount, onshelfholds, opacitemholds, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, maxsuspensiondays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, norenewalbefore=?, auto_renew=?, reservesallowed=?, issuelength=?, lengthunit=?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, onshelfholds=?, opacitemholds=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?");
my $br = $branch; # branch
my $bor = $input->param('categorycode'); # borrower category
my $itemtype = $input->param('itemtype'); # item type
@ -133,14 +130,37 @@ elsif ($op eq 'add') {
my $overduefinescap = $input->param('overduefinescap') || undef;
$debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty";
$sth_search->execute($br,$bor,$itemtype);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
$sth_update->execute($fine, $finedays, $maxsuspensiondays, $firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount, $onshelfholds, $opacitemholds, $overduefinescap, $br,$bor,$itemtype);
} else {
$sth_insert->execute($br,$bor,$itemtype,$maxissueqty,$renewalsallowed, $renewalperiod, $norenewalbefore, $auto_renew, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays, $maxsuspensiondays, $firstremind,$chargeperiod,$rentaldiscount,$onshelfholds,$opacitemholds,$overduefinescap);
}
}
my $schema = Koha::Database->new()->schema();
my $rs = $schema->resultset('Issuingrule');
my $params = {
branchcode => $br,
categorycode => $bor,
itemtype => $itemtype,
fine => $fine,
finedays => $finedays,
maxsuspensiondays => $maxsuspensiondays,
firstremind => $firstremind,
chargeperiod => $chargeperiod,
maxissueqty => $maxissueqty,
renewalsallowed => $renewalsallowed,
renewalperiod => $renewalperiod,
norenewalbefore => $norenewalbefore,
auto_renew => $auto_renew,
reservesallowed => $reservesallowed,
issuelength => $issuelength,
lengthunit => $lengthunit,
hardduedate => $hardduedate,
hardduedatecompare => $hardduedatecompare,
rentaldiscount => $rentaldiscount,
onshelfholds => $onshelfholds,
opacitemholds => $opacitemholds,
overduefinescap => $overduefinescap,
};
$rs->update_or_create($params);
}
elsif ($op eq "set-branch-defaults") {
my $categorycode = $input->param('categorycode');
my $maxissueqty = $input->param('maxissueqty');
@ -413,7 +433,7 @@ if ($branch eq "*") {
SELECT default_borrower_circ_rules.*, categories.description AS humancategorycode
FROM default_borrower_circ_rules
JOIN categories USING (categorycode)
");
$sth_branch_cat->execute();
} else {
@ -507,7 +527,7 @@ $template->param(categoryloop => \@category_loop,
branchloop => \@branchloop,
humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''),
current_branch => $branch,
definedbranch => scalar(@sorted_row_loop)>0
definedbranch => scalar(@sorted_row_loop)>0
);
output_html_with_http_headers $input, $cookie, $template->output;

View file

@ -635,7 +635,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) {
&& !$itemtypes->{$itm->{'itype'}}->{notforloan}
&& $itm->{'itemnumber'};
$allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed($itm, $borrower)
$allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, $borrower )
unless $allow_onshelf_holds;
# get collection code description, too