# this is where we set the From: address
$from ||= $conf->config('quotation_from', $self->cust_or_prospect->agentnum )
- || $conf->config('invoice_from', $self->cust_or_prospect->agentnum );
-
+ || $conf->invoice_from_full( $self->cust_or_prospect->agentnum );
$self->SUPER::email( {
'from' => $from,
%$opt,
sub order {
my $self = shift;
- tie my %cust_pkg, 'Tie::RefHash',
- map { FS::cust_pkg->new({ pkgpart => $_->pkgpart,
- quantity => $_->quantity,
- })
- => [] #services
- }
- $self->quotation_pkg ;
+ tie my %all_cust_pkg, 'Tie::RefHash';
+ foreach my $quotation_pkg ($self->quotation_pkg) {
+ my $cust_pkg = FS::cust_pkg->new;
+ foreach (qw(pkgpart locationnum start_date contract_end quantity waive_setup)) {
+ $cust_pkg->set( $_, $quotation_pkg->get($_) );
+ }
+
+ # currently only one discount each
+ my ($pkg_discount) = $quotation_pkg->quotation_pkg_discount;
+ if ( $pkg_discount ) {
+ $cust_pkg->set('discountnum', $pkg_discount->discountnum);
+ }
+
+ $all_cust_pkg{$cust_pkg} = []; # no services
+ }
- $self->cust_main->order_pkgs( \%cust_pkg );
+ $self->cust_main->order_pkgs( \%all_cust_pkg );
}