$sth->execute($subscriptionid);
my ( $missinglist, $recievedlist ) = $sth->fetchrow;
if ( $status == 2 ) {
-
$recievedlist .= "; $serialseq"
- unless ( index( "$recievedlist", "$serialseq" ) >= 0 );
+ if $recievedlist!~/(^|;)\s*$serialseq(?=;|$)/;
+ }
+ # in case serial has been previously marked as missing
+ if (grep /$status/, (1,2,3,7)) {
+ $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g;
}
-
- # warn "missinglist : $missinglist serialseq :$serialseq, ".index("$missinglist","$serialseq");
$missinglist .= "; $serialseq"
- if ( $status == 4
- and not index( "$missinglist", "$serialseq" ) >= 0 );
+ if $status==4 && $missinglist!~/(^|;)\s*$serialseq(?=;|$)/;
$missinglist .= "; not issued $serialseq"
- if ( $status == 5
- and index( "$missinglist", "$serialseq" ) >= 0 );
+ if $status==5 && $missinglist!~/(^|;)\s*$serialseq(?=;|$)/;
+
$query = "UPDATE subscriptionhistory SET recievedlist=?, missinglist=? WHERE subscriptionid=?";
$sth = $dbh->prepare($query);
$recievedlist =~ s/^; //;
my $biblioLoop = [];
my $numBibsAvailable = 0;
my $itemdata_enumchron = 0;
-my $anyholdable;
+my $anyholdable = 0;
my $itemLevelTypes = C4::Context->preference('item-level_itypes');
$template->param('item_level_itypes' => $itemLevelTypes);
$numBibsAvailable++;
$biblioLoopIter{bib_available} = 1;
$biblioLoopIter{holdable} = 1;
- $anyholdable = 1;
}
if ($biblioLoopIter{already_reserved}) {
$biblioLoopIter{holdable} = undef;
- $anyholdable = undef;
}
if(not CanBookBeReserved($borrowernumber,$biblioNum)){
$biblioLoopIter{holdable} = undef;
- $anyholdable = undef;
}
if(not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowernumber,$biblioNum)) {
$biblioLoopIter{holdable} = undef;
$biblioLoopIter{already_patron_possession} = 1;
- $anyholdable = undef;
}
+ if( $biblioLoopIter{holdable} ){ $anyholdable++; }
+
push @$biblioLoop, \%biblioLoopIter;
}
-if ( $numBibsAvailable == 0 || !$anyholdable) {
+if ( $numBibsAvailable == 0 || $anyholdable == 0) {
$template->param( none_available => 1 );
}