|
Lines 15-20
Link Here
|
| 15 |
# You should have received a copy of the GNU General Public License |
15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
17 |
|
|
|
18 |
# FIXME: Processing of invalid dates (00/00/0000 or 33/33/2999) needs |
| 19 |
# some more attention. At the moment subscription will be saved with |
| 20 |
# empty dates, subscription detail page will display a warning if |
| 21 |
# startdate and/or enddate are empty. |
| 22 |
|
| 18 |
use strict; |
23 |
use strict; |
| 19 |
use warnings; |
24 |
use warnings; |
| 20 |
|
25 |
|
|
Lines 324-345
sub redirect_add_subscription {
Link Here
|
| 324 |
my $skip_serialseq = $query->param('skip_serialseq'); |
329 |
my $skip_serialseq = $query->param('skip_serialseq'); |
| 325 |
|
330 |
|
| 326 |
my $startdate = $query->param('startdate'); |
331 |
my $startdate = $query->param('startdate'); |
| 327 |
$startdate = eval { dt_from_string( $startdate ); } if ( $startdate ); |
332 |
my $startdate_dt = eval { dt_from_string( $startdate ); } if ( $startdate ); |
| 328 |
$startdate = output_pref( { dt => $startdate, dateonly => 1, dateformat => 'iso' } ) if ( $startdate ); |
333 |
if ( $startdate_dt ) { |
|
|
334 |
$startdate = output_pref( { dt => $startdate_dt, dateonly => 1, dateformat => 'iso' } ); |
| 335 |
} |
| 336 |
else { |
| 337 |
$startdate = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); |
| 338 |
} |
| 329 |
|
339 |
|
| 330 |
my $enddate = $query->param('enddate'); |
340 |
my $enddate = $query->param('enddate'); |
| 331 |
$enddate = eval { dt_from_string( $enddate ); } if ( $enddate ); |
341 |
my $enddate_dt = eval { dt_from_string( $enddate ); } if ( $enddate ); |
| 332 |
$enddate = output_pref( { dt => $enddate, dateonly => 1, dateformat => 'iso' } ) if ( $enddate ); |
342 |
if ( $enddate_dt ) { |
|
|
343 |
$enddate = output_pref( { dt => $enddate_dt, dateonly => 1, dateformat => 'iso' } ); |
| 344 |
} |
| 345 |
else { |
| 346 |
$enddate = undef; |
| 347 |
} |
| 348 |
|
| 333 |
my $firstacquidate = $query->param('firstacquidate'); |
349 |
my $firstacquidate = $query->param('firstacquidate'); |
| 334 |
$firstacquidate = eval { dt_from_string( $firstacquidate ); } if ( $firstacquidate ); |
350 |
my $firstacquidate_dt = eval { dt_from_string( $firstacquidate ); } if ( $firstacquidate ); |
| 335 |
$firstacquidate = output_pref( { dt => $enddate, dateonly => 1, dateformat => 'iso' } ) if ( $firstacquidate ); |
351 |
if ($firstacquidate_dt ) { |
|
|
352 |
$firstacquidate = output_pref( { dt => $firstacquidate_dt, dateonly => 1, dateformat => 'iso' } ); |
| 353 |
} |
| 354 |
else { |
| 355 |
$firstacquidate = undef; |
| 356 |
} |
| 336 |
|
357 |
|
| 337 |
if(!defined $enddate || $enddate eq '') { |
358 |
if(!defined $enddate || $enddate eq '') { |
| 338 |
if($subtype eq "issues") { |
359 |
if($subtype eq "issues") { |
| 339 |
$enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength); |
360 |
$enddate = eval { _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength); }; |
| 340 |
} else { |
361 |
} else { |
| 341 |
$enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); |
362 |
$enddate = eval { _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); }; |
| 342 |
} |
363 |
} |
|
|
364 |
#FIXME We set $enddate to empty string if there was a problem with guessing; |
| 365 |
$enddate = ''; |
| 343 |
} |
366 |
} |
| 344 |
|
367 |
|
| 345 |
my $subscriptionid = NewSubscription( |
368 |
my $subscriptionid = NewSubscription( |
|
Lines 418-427
sub redirect_mod_subscription {
Link Here
|
| 418 |
# Guess end date |
441 |
# Guess end date |
| 419 |
if(!defined $enddate || $enddate eq '') { |
442 |
if(!defined $enddate || $enddate eq '') { |
| 420 |
if($subtype eq "issues") { |
443 |
if($subtype eq "issues") { |
| 421 |
$enddate = _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength); |
444 |
$enddate = eval { _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength); }; |
| 422 |
} else { |
445 |
} else { |
| 423 |
$enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); |
446 |
$enddate = eval {_guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); }; |
| 424 |
} |
447 |
} |
|
|
448 |
#FIXME We set $enddate totoday if it is empty; |
| 449 |
$enddate = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ) unless ( $enddate ); |
| 425 |
} |
450 |
} |
| 426 |
|
451 |
|
| 427 |
my $nextexpected = GetNextExpected($subscriptionid); |
452 |
my $nextexpected = GetNextExpected($subscriptionid); |
| 428 |
- |
|
|