diff --git a/C4/Bull.pm b/C4/Bull.pm index 502b784a5d..624e1efd25 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -56,7 +56,8 @@ Give all XYZ functions &getSupplierListWithLateIssues &GetLateIssues &GetMissingIssues &getroutinglist &delroutingmember &addroutingmember &reorder_members &check_routing &getsupplierbyserialid &updateClaim &removeMissingIssue &abouttoexpire - &old_getserials &old_newsubscription &old_modsubscription &old_serialchangestatus); + &old_getserials &old_newsubscription &old_modsubscription &old_serialchangestatus + &is_able_to_receive); # for removing the missing issue sequence from the box on check-in page sub removeMissingIssue { @@ -695,6 +696,36 @@ sub newissue { VALUES (?,?,?,?,?,?)"); $sth->execute($serialseq,$subscriptionid,$biblionumber,$status,$publisheddate, $planneddate); } +=head2 is_able_to_receive + + is_able_to_receive(); + contains an array of kohafields to check + my @fields = ('items.dateaccessioned','items.notforloan','items.location','items.itemnotes', + 'items.itemcallnumber','items.holdingbranch','items.homebranch','items.barcode'); + returns nothing or an array indicating which koha2marklins are not set for the serialsitemize subroutine +=cut + +sub is_able_to_receive { + my @fields = ('items.dateaccessioned','items.notforloan','items.location','items.itemnotes','items.itemcallnumber','items.holdingbranch','items.homebranch','items.barcode'); + my @errors; + for(my $i=0;$i<@fields;$i++){ + my $dbh= C4::Context->dbh; + my $sth=$dbh->prepare("SELECT tagfield,tagsubfield + FROM marc_subfield_structure + WHERE kohafield = ?"); + $sth->execute($fields[$i]); + my $data=$sth->fetchrow_hashref; + if($data->{'tagfield'} && $data->{'tagsubfield'}){ + # is ok + } else { + my %line; + $line{"errorline"} = $fields[$i]; + push @errors,\%line; + } + $sth->finish; + } + return @errors; +} =head2 serialsitemize diff --git a/bull/statecollection.pl b/bull/statecollection.pl index 68b12d5442..11442934d3 100755 --- a/bull/statecollection.pl +++ b/bull/statecollection.pl @@ -204,11 +204,13 @@ if (C4::Context->preference("serialsadditems")){ $template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) ; } +my @parameter_check = is_able_to_receive(); $template->param( user => $auser, serialslist => \@serialslist, - count => $count, + count => $count, + parameter_check => \@parameter_check, biblionumber => $subscription->{biblionumber}, histstartdate => format_date($solhistory->{'histstartdate'}), enddate => format_date($solhistory->{'enddate'}),