[freeside-commits] freeside/FS/FS cust_bill.pm, 1.205, 1.206 Schema.pm, 1.86, 1.87 cust_pkg.pm, 1.92, 1.93 cust_bill_pkg.pm, 1.16, 1.17
Ivan,,,
ivan at wavetail.420.am
Tue Jun 3 14:06:24 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv9239/FS/FS
Modified Files:
cust_bill.pm Schema.pm cust_pkg.pm cust_bill_pkg.pm
Log Message:
very basic start at adding quantities
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- Schema.pm 19 May 2008 04:29:01 -0000 1.86
+++ Schema.pm 3 Jun 2008 21:06:22 -0000 1.87
@@ -496,6 +496,9 @@
'sdate', @date_type, '', '',
'edate', @date_type, '', '',
'itemdesc', 'varchar', 'NULL', $char_d, '', '',
+ 'quantity', 'int', 'NULL', '', '', '',
+ 'unitsetup', @money_type, '', '',
+ 'unitrecur', @money_type, '', '',
],
'primary_key' => 'billpkgnum',
'unique' => [],
@@ -908,6 +911,7 @@
'change_pkgnum', 'int', 'NULL', '', '', '',
'change_pkgpart', 'int', 'NULL', '', '', '',
'manual_flag', 'char', 'NULL', 1, '', '',
+ 'quantity', 'int', 'NULL', '', '', '',
],
'primary_key' => 'pkgnum',
'unique' => [],
Index: cust_bill_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill_pkg.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cust_bill_pkg.pm 19 May 2008 22:31:29 -0000 1.16
+++ cust_bill_pkg.pm 3 Jun 2008 21:06:22 -0000 1.17
@@ -57,6 +57,12 @@
=item itemdesc - Line item description (currentlty used only when pkgnum is 0 or -1)
+=item quantity - If not set, defaults to 1
+
+=item unitsetup - If not set, defaults to setup
+
+=item unitrecur - If not set, defaults to recur
+
=back
sdate and edate are specified as UNIX timestamps; see L<perlfunc/"time">. Also
@@ -367,6 +373,46 @@
$self->part_pkg->calc_units($self->cust_pkg);
}
+=item quantity
+
+=cut
+
+sub quantity {
+ my( $self, $value ) = @_;
+ if ( defined($value) ) {
+ $self->setfield('quantity', $value);
+ }
+ $self->getfield('quantity') || 1;
+}
+
+=item unitsetup
+
+=cut
+
+sub unitsetup {
+ my( $self, $value ) = @_;
+ if ( defined($value) ) {
+ $self->setfield('unitsetup', $value);
+ }
+ $self->getfield('unitsetup') eq ''
+ ? $self->getfield('setup')
+ : $self->getfield('unitsetup');
+}
+
+=item unitrecur
+
+=cut
+
+sub unitrecur {
+ my( $self, $value ) = @_;
+ if ( defined($value) ) {
+ $self->setfield('unitrecur', $value);
+ }
+ $self->getfield('unitrecur') eq ''
+ ? $self->getfield('recur')
+ : $self->getfield('unitrecur');
+}
+
=back
=head1 BUGS
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- cust_bill.pm 2 Jun 2008 11:16:09 -0000 1.205
+++ cust_bill.pm 3 Jun 2008 21:06:21 -0000 1.206
@@ -1834,7 +1834,7 @@
'state' => &$escape_function($cust_main->state),
'zip' => &$escape_function($cust_main->zip),
'returnaddress' => $returnaddress,
- 'quantity' => 1,
+ #'quantity' => 1,
'terms' => $self->terms,
'template' => $params{'template'},
#'notes' => join("\n", $conf->config('invoice_latexnotes') ),
@@ -1990,10 +1990,8 @@
&$escape_function($_);
} @{$line_item->{'ext_description'}};
}
- {
- my $money = $old_latex ? '' : $money_char;
- $detail->{'amount'} = $money. $line_item->{'amount'};
- }
+ $detail->{'amount'} = ( $old_latex ? '' : $money_char).
+ $line_item->{'amount'};
$detail->{'product_code'} = $line_item->{'pkgpart'} || 'N/A';
push @detail_items, $detail;
@@ -2031,16 +2029,16 @@
ext_description => [],
};
$detail->{'ref'} = $line_item->{'pkgnum'};
- $detail->{'quantity'} = 1;
+ $detail->{'quantity'} = $line_item->{'quantity'};
$detail->{'section'} = $section;
$detail->{'description'} = &$escape_function($line_item->{'description'});
if ( exists $line_item->{'ext_description'} ) {
@{$detail->{'ext_description'}} = @{$line_item->{'ext_description'}};
}
- {
- my $money = $old_latex ? '' : $money_char;
- $detail->{'amount'} = $money. $line_item->{'amount'};
- }
+ $detail->{'amount'} = ( $old_latex ? '' : $money_char ).
+ $line_item->{'amount'};
+ $detail->{'unit_amount'} = ( $old_latex ? '' : $money_char ).
+ $line_item->{'unit_amount'};
$detail->{'product_code'} = $line_item->{'pkgpart'} || 'N/A';
push @detail_items, $detail;
@@ -2623,6 +2621,8 @@
#pkgpart => $part_pkg->pkgpart,
pkgnum => $cust_bill_pkg->pkgnum,
amount => sprintf("%.2f", $cust_bill_pkg->setup),
+ unit_amount => sprintf("%.2f", $cust_bill_pkg->unitsetup),
+ quantity => $cust_bill_pkg->quantity,
ext_description => \@d,
};
}
@@ -2648,8 +2648,9 @@
#pkgpart => $part_pkg->pkgpart,
pkgnum => $cust_bill_pkg->pkgnum,
amount => sprintf("%.2f", $cust_bill_pkg->recur),
+ unit_amount => sprintf("%.2f", $cust_bill_pkg->unitrecur),
+ quantity => $cust_bill_pkg->quantity,
ext_description => \@d,
-
};
}
Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- cust_pkg.pm 17 Apr 2008 01:39:53 -0000 1.92
+++ cust_pkg.pm 3 Jun 2008 21:06:22 -0000 1.93
@@ -128,6 +128,8 @@
=item manual_flag - If this field is set to 1, disables the automatic
unsuspension of this package when using the B<unsuspendauto> config file.
+=item quantity - If not set, defaults to 1
+
=back
Note: setup, bill, adjourn, susp, expire and cancel are specified as UNIX timestamps;
@@ -1335,6 +1337,18 @@
}
+=item quantity
+
+=cut
+
+sub quantity {
+ my( $self, $value ) = @_;
+ if ( defined($value) ) {
+ $self->setfield('quantity', $value);
+ }
+ $self->getfield('quantity') || 1;
+}
+
=item transfer DEST_PKGNUM | DEST_CUST_PKG, [ OPTION => VALUE ... ]
Transfers as many services as possible from this package to another package.
More information about the freeside-commits
mailing list