From 3286b0660749c4ae6b7f1f4614c39f62e70c226b Mon Sep 17 00:00:00 2001 From: hdl Date: Thu, 24 May 2007 16:11:39 +0000 Subject: [PATCH] Changing signature for NewIssue (To be more unify to other subs signature) --- C4/Serials.pm | 68 +++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 0aa88b53c1..2a54851aef 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1055,36 +1055,40 @@ sub GetExpirationDate { # use Data::Dumper; warn Dumper($subscription); # warn "dateCHECKRESERV :".$subscription->{startdate}; - if ( $subscription->{numberlength} ) { - #calculate the date of the last issue. - my $length = $subscription->{numberlength}; -# warn "ENDDATE ".$enddate; - for ( my $i = 1 ; $i <= $length ; $i++ ) { - $enddate = GetNextDate( $enddate, $subscription ); -# warn "AFTER ENDDATE ".$enddate; - } - } - elsif ( $subscription->{monthlength} ){ - my @date=split (/-/,$subscription->{startdate}); - my @enddate = Add_Delta_YM($date[0],$date[1],$date[2],0,$subscription->{monthlength}); - $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]); - } elsif ( $subscription->{weeklength} ){ - my @date=split (/-/,$subscription->{startdate}); -# warn "dateCHECKRESERV :".$subscription->{startdate}; -#### An other way to do it -# if ( $subscription->{weeklength} ){ -# my ($weeknb,$year)=Week_of_Year(@startdate); -# $weeknb += $subscription->{weeklength}; -# my $weeknbcalc= $weeknb % 52; -# $year += int($weeknb/52); -# # warn "year : $year weeknb :$weeknb weeknbcalc $weeknbcalc"; -# @endofsubscriptiondate=Monday_of_Week($weeknbcalc,$year); -# } - my @enddate = Add_Delta_Days($date[0],$date[1],$date[2],$subscription->{weeklength}*7); - $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]); - } -# warn "date de fin :$enddate"; - return $enddate; + if ($subscription->{periodicity}){ + if ( $subscription->{numberlength} ) { + #calculate the date of the last issue. + my $length = $subscription->{numberlength}; + # warn "ENDDATE ".$enddate; + for ( my $i = 1 ; $i <= $length ; $i++ ) { + $enddate = GetNextDate( $enddate, $subscription ); + # warn "AFTER ENDDATE ".$enddate; + } + } + elsif ( $subscription->{monthlength} ){ + my @date=split (/-/,$subscription->{startdate}); + my @enddate = Add_Delta_YM($date[0],$date[1],$date[2],0,$subscription->{monthlength}); + $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]); + } elsif ( $subscription->{weeklength} ){ + my @date=split (/-/,$subscription->{startdate}); + # warn "dateCHECKRESERV :".$subscription->{startdate}; + #### An other way to do it + # if ( $subscription->{weeklength} ){ + # my ($weeknb,$year)=Week_of_Year(@startdate); + # $weeknb += $subscription->{weeklength}; + # my $weeknbcalc= $weeknb % 52; + # $year += int($weeknb/52); + # # warn "year : $year weeknb :$weeknb weeknbcalc $weeknbcalc"; + # @endofsubscriptiondate=Monday_of_Week($weeknbcalc,$year); + # } + my @enddate = Add_Delta_Days($date[0],$date[1],$date[2],$subscription->{weeklength}*7); + $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]); + } + # warn "date de fin :$enddate"; + return $enddate; + } else { + return 0; + } } =head2 CountSubscriptionFromBiblionumber @@ -1482,8 +1486,8 @@ Note : we have to update the recievedlist and missinglist on subscriptionhistory =cut sub NewIssue { - my ( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, - $planneddate, $notes ) + my ( $serialseq, $subscriptionid, $biblionumber, $status, + $planneddate, $publisheddate, $notes ) = @_; ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? -- 2.39.5