X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=serials%2Fserials-recieve.pl;h=770d10d1e03fe910178b03aa08ed6319602989cf;hb=4dbd7c452878ef9eea411f54e3f90820bc8a3e1f;hp=830c56a9752dbba3b2da874882f64e1affc721a2;hpb=100e6a9808ead4ee8d951da59ead1550e75bb4c3;p=koha_fer diff --git a/serials/serials-recieve.pl b/serials/serials-recieve.pl index 830c56a975..770d10d1e0 100755 --- a/serials/serials-recieve.pl +++ b/serials/serials-recieve.pl @@ -13,11 +13,10 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# $Id$ =head1 NAME @@ -29,7 +28,7 @@ serials-recieve.pl =item op op can be : - * modsubscriptionhistory :to modify the subscription history + * modsubscriptionhistory :to modify the subscription history * serialchangestatus :to modify the status of this subscription =item subscriptionid @@ -64,10 +63,12 @@ op can be : use strict; +use warnings; use CGI; use C4::Auth; -use C4::Date; +use C4::Dates qw/format_date format_date_in_iso/; use C4::Biblio; +use C4::Items; use C4::Koha; use C4::Output; use C4::Context; @@ -75,7 +76,7 @@ use C4::Serials; use C4::Branch; # GetBranches my $query = new CGI; -my $op = $query->param('op'); +my $op = $query->param('op') || q{}; my $dbh = C4::Context->dbh; my $subscriptionid = $query->param('subscriptionid'); # my $auser = $query->param('user'); @@ -125,7 +126,7 @@ if ($op eq 'serialchangestatus') { my $sth = $dbh->prepare("select status from serial where serialid=?"); for (my $i=0;$i<=$#serialids;$i++) { $sth->execute($serialids[$i]); - + my ($oldstatus) = $sth->fetchrow; if ($serialids[$i]) { ModSerialStatus($serialids[$i],$serialseqs[$i],format_date_in_iso($planneddates[$i]),format_date_in_iso($publisheddates[$i]),$status[$i],$notes[$i]) unless ($hassubscriptionexpired && $oldstatus == 1); @@ -140,11 +141,11 @@ if ($op eq 'serialchangestatus') { my ($status2, @errors)= ItemizeSerials($serialids[$i],\%info); my $sth2 = $dbh->prepare("UPDATE subscriptionhistory SET lastbranch = ? WHERE subscriptionid = ?"); $sth2->execute($homebranches[$i],$subscriptionid); - $sth2->finish; + $sth2->finish; # remove from missing list if item being checked in is on it if ($status2 ==1){ removeMissingIssue($serialseqs[$i],$subscriptionid); - } + } } } else { # add a special issue @@ -185,7 +186,7 @@ my $subs = &GetSubscription($subscriptionid); my ($totalissues,@serialslist) = GetSerials($subscriptionid); my $count = @serialslist; for(my $i=0;$i<$count;$i++){ - warn "la : $i"; + #warn "la : $i"; $serialslist[$i]->{'callnumber'} = $subscription->{'callnumber'}; my $temp = rand(10000000); $serialslist[$i]->{'barcode'} = "TEMP" . sprintf("%.0f",$temp); @@ -196,8 +197,8 @@ my $sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId(); $sth->execute($subscriptionid); my $solhistory = $sth->fetchrow_hashref; -my $subs = &GetSubscription($subscriptionid); -my ($totalissues,@serialslist) = GetSerials($subscriptionid); +$subs = &GetSubscription($subscriptionid); +($totalissues,@serialslist) = GetSerials($subscriptionid); if (C4::Context->preference("serialsadditems")){ my $fwk=GetFrameworkCode($subscription->{biblionumber}); @@ -217,13 +218,13 @@ if (C4::Context->preference("serialsadditems")){ } my $itemstatushash = GetItemStatus($fwk); my @itemstatusloop; - my $itemstatusloopcount=0; + my $itemstatusloopcount=0; foreach my $thisitemstatus (keys %$itemstatushash) { my %row =(itemval => $thisitemstatus, itemlib => $itemstatushash->{$thisitemstatus}, ); # warn "".$row{'itemval'}.", ". $row{"itemlib"}; - $itemstatusloopcount++; + $itemstatusloopcount++; push @itemstatusloop, \%row; } my $itemlocationhash = GetItemLocation($fwk); @@ -235,29 +236,26 @@ if (C4::Context->preference("serialsadditems")){ push @itemlocationloop, \%row; } - my $choice = 0; - if($itemstatusloopcount == 1){ $choice = 1;} - foreach my $data (@serialslist){ - if (scalar(@itemstatusloop)){$data->{"itemstatusloop"}=\@itemstatusloop;} - else { $data->{"itemstatusloop"}=[];} - if (scalar(@itemlocationloop)){$data->{"itemlocationloop"}=\@itemlocationloop;} - else {$data->{"itemlocationloop"}=[];} - $data->{"branchloop"}=\@branchloop ; - } + my $choice = ($itemstatusloopcount == 1) ? 1 : 0; + foreach my $data (@serialslist){ + $data->{"itemstatusloop"} = (scalar(@itemstatusloop )) ? \@itemstatusloop : []; + $data->{"itemlocationloop"} = (scalar(@itemlocationloop)) ? \@itemlocationloop : []; + $data->{"branchloop"} = \@branchloop ; + } # warn "Choice: $choice"; - $template->param(choice => $choice); + $template->param(choice => $choice); $template->param(serialadditems =>C4::Context->preference("serialsadditems"), branchloop => \@branchloop, ) ; - $template->param(itemstatus=>1,itemstatusloop=>\@itemstatusloop) if (scalar(@itemstatusloop)); - $template->param(itemlocation=>1,itemlocationloop=>\@itemlocationloop) if (scalar(@itemlocationloop)); -}else{ + $template->param( itemstatus=>1, itemstatusloop=>\@itemstatusloop ) if (scalar(@itemstatusloop )); + $template->param(itemlocation=>1,itemlocationloop=>\@itemlocationloop) if (scalar(@itemlocationloop)); +} else { $template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) ; } -my $sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId(); +$sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId(); $sth->execute($subscriptionid); -my $solhistory = $sth->fetchrow_hashref; +$solhistory = $sth->fetchrow_hashref; $template->param( user => $auser, @@ -274,14 +272,12 @@ $template->param( bibliotitle => $subs->{bibliotitle}, biblionumber => $subs->{biblionumber}, hassubscriptionexpired =>$hassubscriptionexpired, - abouttoexpire =>$abouttoexpire, - intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), - intranetstylesheet => C4::Context->preference("intranetstylesheet"), - IntranetNav => C4::Context->preference("IntranetNav"), + abouttoexpire =>$abouttoexpire, routing => $routing, missingseq => $manualissue, frommissing => $manualstatus, missingdate => $manualdate, missingid => $manualid, + (uc(C4::Context->preference("marcflavour"))) => 1 ); output_html_with_http_headers $query, $cookie, $template->output;