[freeside-commits] freeside/FS/FS cust_bill.pm, 1.163.2.28, 1.163.2.29 Schema.pm, 1.44.2.24, 1.44.2.25 cust_pkg.pm, 1.73.2.13, 1.73.2.14 cust_bill_pkg.pm, 1.12.2.2, 1.12.2.3
Ivan,,,
ivan at wavetail.420.am
Tue Jun 3 14:06:41 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv9268/FS/FS
Modified Files:
Tag: FREESIDE_1_7_BRANCH
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.44.2.24
retrieving revision 1.44.2.25
diff -u -d -r1.44.2.24 -r1.44.2.25
--- Schema.pm 19 May 2008 04:29:03 -0000 1.44.2.24
+++ Schema.pm 3 Jun 2008 21:06:33 -0000 1.44.2.25
@@ -414,6 +414,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' => [],
@@ -763,6 +766,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.12.2.2
retrieving revision 1.12.2.3
diff -u -d -r1.12.2.2 -r1.12.2.3
--- cust_bill_pkg.pm 19 May 2008 22:31:17 -0000 1.12.2.2
+++ cust_bill_pkg.pm 3 Jun 2008 21:06:33 -0000 1.12.2.3
@@ -55,6 +55,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
@@ -338,6 +344,46 @@
);
}
+=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.163.2.28
retrieving revision 1.163.2.29
diff -u -d -r1.163.2.28 -r1.163.2.29
--- cust_bill.pm 2 Jun 2008 11:17:20 -0000 1.163.2.28
+++ cust_bill.pm 3 Jun 2008 21:06:32 -0000 1.163.2.29
@@ -1802,6 +1802,7 @@
'address2' => _latex_escape($cust_main->address2),
'city' => _latex_escape($cust_main->city),
'state' => _latex_escape($cust_main->state),
+ #'quantity' => 1,
'zip' => _latex_escape($cust_main->zip),
'footer' => join("\n", $conf->config_orbase('invoice_latexfooter', $template) ),
'smallfooter' => join("\n", $conf->config_orbase('invoice_latexsmallfooter', $template) ),
@@ -1886,7 +1887,9 @@
map _latex_escape($_), @{$line_item->{'ext_description'}}
);
}
- $invoice_data{'amount'} = $line_item->{'amount'};
+ $invoice_data{'amount'} = $line_item->{'amount'};
+ $invoice_data{'unit_amount'} = $line_item->{'unit_amount'};
+ $invoice_data{'quantity'} = $line_item->{'quantity'};
$invoice_data{'product_code'} = $line_item->{'pkgpart'} || 'N/A';
push @filled_in,
map { my $b=$_; $b =~ s/\$(\w+)/$invoice_data{$1}/eg; $b } @line_item;
@@ -1992,6 +1995,7 @@
@{$detail->{'ext_description'}} = @{$line_item->{'ext_description'}};
}
$detail->{'amount'} = $line_item->{'amount'};
+ $detail->{'unit_amount'} = $line_item->{'unit_amount'};
$detail->{'product_code'} = $line_item->{'pkgpart'} || 'N/A';
push @detail_items, $detail;
@@ -2483,6 +2487,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,
};
}
@@ -2508,8 +2514,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.73.2.13
retrieving revision 1.73.2.14
diff -u -d -r1.73.2.13 -r1.73.2.14
--- cust_pkg.pm 16 Apr 2008 18:32:32 -0000 1.73.2.13
+++ cust_pkg.pm 3 Jun 2008 21:06:33 -0000 1.73.2.14
@@ -125,6 +125,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;
@@ -1241,6 +1243,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