|
Lines 54-59
use C4::Context;
Link Here
|
| 54 |
use C4::Auth; |
54 |
use C4::Auth; |
| 55 |
use C4::Output; |
55 |
use C4::Output; |
| 56 |
use C4::Serials; |
56 |
use C4::Serials; |
|
|
57 |
use C4::Serials::Frequency; |
| 58 |
use C4::Serials::Numberpattern; |
| 59 |
use Date::Calc qw(Today Day_of_Year Week_of_Year Add_Delta_Days Add_Delta_YM); |
| 57 |
use Koha::DateUtils; |
60 |
use Koha::DateUtils; |
| 58 |
|
61 |
|
| 59 |
my $query = new CGI; |
62 |
my $query = new CGI; |
|
Lines 74-79
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
| 74 |
} |
77 |
} |
| 75 |
); |
78 |
); |
| 76 |
if ( $op eq "renew" ) { |
79 |
if ( $op eq "renew" ) { |
|
|
80 |
my @permanent_irregularities = $query->param('permanent_irregularity'); |
| 81 |
my @irregularities = $query->param('irregularity'); |
| 77 |
my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } ); |
82 |
my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } ); |
| 78 |
ReNewSubscription( |
83 |
ReNewSubscription( |
| 79 |
$subscriptionid, $loggedinuser, |
84 |
$subscriptionid, $loggedinuser, |
|
Lines 81-86
if ( $op eq "renew" ) {
Link Here
|
| 81 |
$query->param('weeklength'), $query->param('monthlength'), |
86 |
$query->param('weeklength'), $query->param('monthlength'), |
| 82 |
$query->param('note') |
87 |
$query->param('note') |
| 83 |
); |
88 |
); |
|
|
89 |
|
| 90 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
| 91 |
$subscription->permanent_irregularity(join(';', @permanent_irregularities)); |
| 92 |
$subscription->irregularity(join(';', @irregularities)); |
| 93 |
$subscription->store; |
| 84 |
} |
94 |
} |
| 85 |
|
95 |
|
| 86 |
my $subscription = GetSubscription($subscriptionid); |
96 |
my $subscription = GetSubscription($subscriptionid); |
|
Lines 92-106
if ($subscription->{'cannotedit'}){
Link Here
|
| 92 |
my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } ) |
102 |
my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } ) |
| 93 |
or output_pref( { dt => dt_from_string, dateonly => 1 } ); |
103 |
or output_pref( { dt => dt_from_string, dateonly => 1 } ); |
| 94 |
|
104 |
|
|
|
105 |
my ($serials_number) = GetSerials($subscriptionid); |
| 106 |
if ($serials_number > 1) { |
| 107 |
$template->param(more_than_one_serial => 1); |
| 108 |
} |
| 109 |
|
| 110 |
my $subscription_o = Koha::Subscriptions->find($subscription->{subscriptionid}); |
| 111 |
my $subtype = $subscription_o->subtype; |
| 112 |
my $nextexpected = GetNextExpected($subscriptionid); |
| 113 |
my $enddate = GuessEnddate($subscription->{enddate} || dt_from_string, |
| 114 |
$subscription->{periodicity}, |
| 115 |
$subscription->{numberlength}, |
| 116 |
$subscription->{weeklength}, |
| 117 |
$subscription->{monthlength}); |
| 118 |
|
| 119 |
my $sub_length; |
| 120 |
foreach my $length_unit (qw(numberlength weeklength monthlength)) { |
| 121 |
if ($subscription->{$length_unit}) { |
| 122 |
$sub_length=$subscription->{$length_unit}; |
| 123 |
last; |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
my $numberpattern = GetSubscriptionNumberpattern($subscription->{numberpattern}); |
| 128 |
|
| 95 |
$template->param( |
129 |
$template->param( |
| 96 |
startdate => $newstartdate, |
130 |
startdate => $newstartdate, |
| 97 |
numberlength => $subscription->{numberlength}, |
131 |
numberlength => $subscription->{numberlength}, |
| 98 |
weeklength => $subscription->{weeklength}, |
132 |
weeklength => $subscription->{weeklength}, |
| 99 |
monthlength => $subscription->{monthlength}, |
133 |
monthlength => $subscription->{monthlength}, |
| 100 |
subscriptionid => $subscriptionid, |
134 |
subscriptionid => $subscriptionid, |
| 101 |
bibliotitle => $subscription->{bibliotitle}, |
135 |
irregularity => $subscription->{irregularity}, |
| 102 |
$op => 1, |
136 |
periodicity => $subscription->{periodicity}, |
| 103 |
popup => ($mode eq 'popup'), |
137 |
firstacquidate => $subscription->{firstacquidate}, |
|
|
138 |
nextacquidate => $nextexpected->{planneddate}, |
| 139 |
enddate => $enddate, |
| 140 |
subtype => $subtype, |
| 141 |
sublength => $sub_length, |
| 142 |
numberingmethod => $numberpattern->{numberingmethod}, |
| 143 |
lastvalue1 => $subscription->{lastvalue1}, |
| 144 |
lastvalue2 => $subscription->{lastvalue2}, |
| 145 |
lastvalue3 => $subscription->{lastvalue3}, |
| 146 |
add1 => $numberpattern->{add1}, |
| 147 |
add2 => $numberpattern->{add2}, |
| 148 |
add3 => $numberpattern->{add3}, |
| 149 |
every1 => $numberpattern->{every1}, |
| 150 |
every2 => $numberpattern->{every2}, |
| 151 |
every3 => $numberpattern->{every3}, |
| 152 |
innerloop1 => $subscription->{innerloop1}, |
| 153 |
innerloop2 => $subscription->{innerloop2}, |
| 154 |
innerloop3 => $subscription->{innerloop3}, |
| 155 |
setto1 => $numberpattern->{setto1}, |
| 156 |
setto2 => $numberpattern->{setto2}, |
| 157 |
setto3 => $numberpattern->{setto3}, |
| 158 |
numbering1 => $numberpattern->{numbering1}, |
| 159 |
numbering2 => $numberpattern->{numbering2}, |
| 160 |
numbering3 => $numberpattern->{numbering3}, |
| 161 |
whenmorethan1 => $numberpattern->{whenmorethan1}, |
| 162 |
whenmorethan2 => $numberpattern->{whenmorethan2}, |
| 163 |
whenmorethan3 => $numberpattern->{whenmorethan3}, |
| 164 |
locale => $subscription->{locale}, |
| 165 |
bibliotitle => $subscription->{bibliotitle}, |
| 166 |
$op => 1, |
| 167 |
popup => ($mode eq 'popup'), |
| 104 |
); |
168 |
); |
| 105 |
|
169 |
|
| 106 |
# Print the page |
170 |
# Print the page |