10 use C4::Interface::CGI::Output;
15 my $op = $query->param('op');
16 my $dbh = C4::Context->dbh;
19 my ($template, $loggedinuser, $cookie, $subs);
20 my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
21 $publisheddate, $dow, $irregularity, $sublength, $subtype, $numberpattern, $numberlength, $weeklength, $monthlength,
22 $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
23 $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
24 $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
25 $numberingmethod, $status, $biblionumber, $bibliotitle, $callnumber, $notes, $hemisphere);
27 $subscriptionid = $query->param('subscriptionid');
31 $biblionumber = $query->param('biblionumber');
32 &DelSubscription($subscriptionid,$biblionumber);
33 $query->redirect("/cgi-bin/koha/serials/serials-home.pl");
37 my $subs = &GetSubscription($subscriptionid);
38 my ($routing, @routinglist) = getroutinglist($subscriptionid);
39 my ($totalissues,@serialslist) = GetSerials($subscriptionid);
40 $totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue)
41 # the subscription must be deletable if there is NO issues for a reason or another (should not happend, but...)
43 ($template, $loggedinuser, $cookie)
44 = get_template_and_user({template_name => "serials/subscription-detail.tmpl",
48 flagsrequired => {catalogue => 1},
52 my ($user, $cookie, $sessionID, $flags)
53 = checkauth($query, 0, {catalogue => 1}, "intranet");
57 my ($year, $month, $day) = UnixDate("today", "%Y", "%m", "%d");
58 my $firstday = Date_DayOfYear($month,$day,$year);
59 my $wkno = Date_WeekOfYear($month,$day,$year,1); # week starting monday
61 for(my $i=$firstday;$i<($firstday+365);$i=$i+7){
63 if($wkno > 52){$year++; $wkno=1;}
64 if($count>365){$count=$i-365;}
65 my ($y,$m,$d) = Date_NthDayOfYear($year,$count);
66 my $output = "$y-$m-$d";
67 $weekarrayjs .= "'Wk $wkno: ".format_date($output)."',";
74 user => $subs->{auser},
75 librarian => $subs->{librarian},
76 aqbooksellerid => $subs->{aqbooksellerid},
77 aqbooksellername => $subs->{aqbooksellername},
78 cost => $subs->{cost},
79 aqbudgetid => $subs->{aqbudgetid},
80 bookfundid => $subs->{bookfundid},
81 startdate => format_date($subs->{startdate}),
82 publisheddate => format_date($subs->{publisheddate}),
83 periodicity => $subs->{periodicity},
85 irregularity => $subs->{irregularity},
86 numberlength => $subs->{numberlength},
87 weeklength => $subs->{weeklength},
88 monthlength => $subs->{monthlength},
89 numberpattern => $subs->{numberpattern},
90 add1 => $subs->{add1},
91 every1 => $subs->{every1},
92 whenmorethan1 => $subs->{whenmorethan1},
93 innerloop1 => $subs->{innerloop1},
94 setto1 => $subs->{setto1},
95 lastvalue1 => $subs->{lastvalue1},
96 add2 => $subs->{add2},
97 every2 => $subs->{every2},
98 whenmorethan2 => $subs->{whenmorethan2},
99 setto2 => $subs->{setto2},
100 lastvalue2 => $subs->{lastvalue2},
101 innerloop2 => $subs->{innerloop2},
102 add3 => $subs->{add3},
103 every3 => $subs->{every3},
104 whenmorethan3 => $subs->{whenmorethan3},
105 setto3 => $subs->{setto3},
106 lastvalue3 => $subs->{lastvalue3},
107 innerloop3 => $subs->{innerloop3},
108 weekarrayjs => $weekarrayjs,
109 numberingmethod => $subs->{numberingmethod},
110 status => $subs->{status},
111 biblionumber => $subs->{biblionumber},
112 bibliotitle => $subs->{bibliotitle},
113 callnumber => $subs->{callnumber},
114 notes => $subs->{notes},
115 subscriptionid => $subs->{subscriptionid},
116 serialslist => \@serialslist,
117 totalissues => $totalissues,
118 hemisphere => $hemisphere,
121 "periodicity$subs->{periodicity}" => 1,
122 "arrival$subs->{dow}" => 1,
123 "numberpattern$subs->{numberpattern}" => 1,
124 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
125 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
128 output_html_with_http_headers $query, $cookie, $template->output;