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 $today=get_today();
58 my $dateobj=DATE_obj($today);
59 my $year=$dateobj->year;
60 my $month=$dateobj->month;
61 my $day=$dateobj->day_of_month;
62 my $firstday = $dateobj->day_of_year;
63 my $wkno = $dateobj->week_number;
65 for(my $i=$firstday;$i<($firstday+365);$i=$i+7){
67 if($wkno > 52){$year++; $wkno=1;}
68 if($count>365){$count=$i-365;}
69 my $newdate=DateTime->from_day_of_year(year=>$year,day_of_year=>$count);
70 $weekarrayjs .= "'Wk $wkno: ".format_date($newdate->ymd)."',";
77 user => $subs->{auser},
78 librarian => $subs->{librarian},
79 aqbooksellerid => $subs->{aqbooksellerid},
80 aqbooksellername => $subs->{aqbooksellername},
81 cost => $subs->{cost},
82 aqbudgetid => $subs->{aqbudgetid},
83 bookfundid => $subs->{bookfundid},
84 startdate => format_date($subs->{startdate}),
85 publisheddate => format_date($subs->{publisheddate}),
86 periodicity => $subs->{periodicity},
88 irregularity => $subs->{irregularity},
89 numberlength => $subs->{numberlength},
90 weeklength => $subs->{weeklength},
91 monthlength => $subs->{monthlength},
92 numberpattern => $subs->{numberpattern},
93 add1 => $subs->{add1},
94 every1 => $subs->{every1},
95 whenmorethan1 => $subs->{whenmorethan1},
96 innerloop1 => $subs->{innerloop1},
97 setto1 => $subs->{setto1},
98 lastvalue1 => $subs->{lastvalue1},
99 add2 => $subs->{add2},
100 every2 => $subs->{every2},
101 whenmorethan2 => $subs->{whenmorethan2},
102 setto2 => $subs->{setto2},
103 lastvalue2 => $subs->{lastvalue2},
104 innerloop2 => $subs->{innerloop2},
105 add3 => $subs->{add3},
106 every3 => $subs->{every3},
107 whenmorethan3 => $subs->{whenmorethan3},
108 setto3 => $subs->{setto3},
109 lastvalue3 => $subs->{lastvalue3},
110 innerloop3 => $subs->{innerloop3},
111 weekarrayjs => $weekarrayjs,
112 numberingmethod => $subs->{numberingmethod},
113 status => $subs->{status},
114 biblionumber => $subs->{biblionumber},
115 bibliotitle => $subs->{bibliotitle},
116 callnumber => $subs->{callnumber},
117 notes => $subs->{notes},
118 subscriptionid => $subs->{subscriptionid},
119 serialslist => \@serialslist,
120 totalissues => $totalissues,
121 hemisphere => $hemisphere,
124 "periodicity$subs->{periodicity}" => 1,
125 "arrival$subs->{dow}" => 1,
126 "numberpattern$subs->{numberpattern}" => 1,
127 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
128 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
131 output_html_with_http_headers $query, $cookie, $template->output;