Lines 46-51
use Koha::Serial;
Link Here
|
46 |
use Koha::SharedContent; |
46 |
use Koha::SharedContent; |
47 |
use Koha::Subscription::Histories; |
47 |
use Koha::Subscription::Histories; |
48 |
use Koha::Subscriptions; |
48 |
use Koha::Subscriptions; |
|
|
49 |
use Koha::TemplateUtils qw( process_tt ); |
49 |
|
50 |
|
50 |
# Define statuses |
51 |
# Define statuses |
51 |
use constant { |
52 |
use constant { |
Lines 1594-1651
sub NewIssue {
Link Here
|
1594 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1595 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1595 |
|
1596 |
|
1596 |
if ( my $template = $subscription->published_on_template ) { |
1597 |
if ( my $template = $subscription->published_on_template ) { |
1597 |
# If we detect a TT opening tag, run string through Template Toolkit Processor |
1598 |
$publisheddatetext = process_tt( |
1598 |
if ( index( $template, '[%' ) != -1 ) { # Much faster than regex |
1599 |
$template, |
1599 |
my $use_template_cache = C4::Context->config('template_cache_dir') |
1600 |
{ |
1600 |
&& defined $ENV{GATEWAY_INTERFACE}; |
1601 |
subscription => $subscription, |
1601 |
|
1602 |
serialseq => $serialseq, |
1602 |
my $tt = Template->new( |
1603 |
serialseq_x => $subscription->lastvalue1(), |
1603 |
{ |
1604 |
serialseq_y => $subscription->lastvalue2(), |
1604 |
EVAL_PERL => 1, |
1605 |
serialseq_z => $subscription->lastvalue3(), |
1605 |
ABSOLUTE => 1, |
1606 |
subscriptionid => $subscriptionid, |
1606 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
1607 |
biblionumber => $biblionumber, |
1607 |
COMPILE_EXT => $use_template_cache ? '.ttc' : '', |
1608 |
status => $status, |
1608 |
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', |
1609 |
planneddate => $planneddate, |
1609 |
FILTERS => {}, |
1610 |
publisheddate => $publisheddate, |
1610 |
ENCODING => 'UTF-8', |
1611 |
publisheddatetext => $publisheddatetext, |
1611 |
} |
1612 |
notes => $notes, |
1612 |
) or die Template->error(); |
1613 |
routingnotes => $routingnotes, |
1613 |
|
|
|
1614 |
my $schema = Koha::Database->new->schema; |
1615 |
|
1616 |
$schema->txn_begin; |
1617 |
try { |
1618 |
my $text; |
1619 |
$tt->process( |
1620 |
\$template, |
1621 |
{ |
1622 |
subscription => $subscription, |
1623 |
serialseq => $serialseq, |
1624 |
serialseq_x => $subscription->lastvalue1(), |
1625 |
serialseq_y => $subscription->lastvalue2(), |
1626 |
serialseq_z => $subscription->lastvalue3(), |
1627 |
subscriptionid => $subscriptionid, |
1628 |
biblionumber => $biblionumber, |
1629 |
status => $status, |
1630 |
planneddate => $planneddate, |
1631 |
publisheddate => $publisheddate, |
1632 |
publisheddatetext => $publisheddatetext, |
1633 |
notes => $notes, |
1634 |
routingnotes => $routingnotes, |
1635 |
}, |
1636 |
\$text |
1637 |
); |
1638 |
$publisheddatetext = $text; |
1639 |
} |
1640 |
catch { |
1641 |
croak "ERROR PROCESSING TEMPLATE: $_ :: " . $template->error(); |
1642 |
} |
1614 |
} |
1643 |
finally { |
1615 |
); |
1644 |
$schema->txn_rollback; |
|
|
1645 |
}; |
1646 |
} else { |
1647 |
$publisheddatetext = $template; |
1648 |
} |
1649 |
} |
1616 |
} |
1650 |
|
1617 |
|
1651 |
my $serial = Koha::Serial->new( |
1618 |
my $serial = Koha::Serial->new( |
1652 |
- |
|
|