use strict;
return sub
{
	my $dbh = shift;
	
	my $sth = $dbh->prepare("select id, template from jin_template where name='order_thank'");
	$sth->execute;
	
	while (my $row = $sth->fetchrow_hashref)
	{
		next
			if $row->{template} =~ m/HasShippingDue/g;
		
		my @old_t = split /(\<goth\:if\s+var=["']*NoDeliverables["']*\>)/g, $row->{template};
		
		next
			if @old_t < 2;
		
		my @new_t;
		push @new_t, $old_t[0];
		push @new_t, '<goth:if var=HasShippingDue>';
		push @new_t, '	<div class="jinOrderSectionTitle">Shipping due</div>';
		push @new_t, '	<div class="jinOrderSection">#{shipping_due}</div>';
		push @new_t, '</goth:if>';
		push @new_t, '';
		push @new_t, $old_t[1];
		push @new_t, $old_t[2];
		$dbh->do("UPDATE jin_template SET template=".$dbh->quote(join "\n", @new_t)." WHERE id=$row->{id}");
	}
	
	$sth = $dbh->prepare("select id, template from jin_template where name='order_step2'");
	$sth->execute;
	
	while (my $row = $sth->fetchrow_hashref)
	{
		next
			if $row->{template} =~ m/DisplayShippingInfo/g;
		
		my @old_t = split /(\<goth\:if\s+var=["']*DisplayPaymentInfo["']*\>)/g, $row->{template};
		
		next
			if @old_t < 2;
		
		my @new_t;
		push @new_t, $old_t[0];
		push @new_t, '<goth:if var=DisplayShippingInfo>';
		push @new_t, '	<div class="jinOrderSectionTitle">Shipping method</div>';
		push @new_t, '	<div class="jinOrderSection">#{shipping_info}</div>';
		push @new_t, '</goth:if>';
		push @new_t, '';
		push @new_t, $old_t[1];
		push @new_t, $old_t[2];
		
		$dbh->do("UPDATE jin_template SET template=".$dbh->quote(join "\n", @new_t)." WHERE id=$row->{id}");
	}
	
};