[freeside-commits] branch master updated. d040dd06eb4b4bd1d5991445038296f952a38d13

Ivan ivan at 420.am
Tue Jun 13 17:00:40 PDT 2017


The branch, master has been updated
       via  d040dd06eb4b4bd1d5991445038296f952a38d13 (commit)
      from  8a28145d78b44e2f51a5a71dc805bee977ac0738 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d040dd06eb4b4bd1d5991445038296f952a38d13
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jun 13 17:00:38 2017 -0700

    charge for printing usage

diff --git a/FS/FS/part_pkg/fsinc_print.pm b/FS/FS/part_pkg/fsinc_print.pm
new file mode 100644
index 0000000..8f4cfb1
--- /dev/null
+++ b/FS/FS/part_pkg/fsinc_print.pm
@@ -0,0 +1,47 @@
+package FS::part_pkg::fsinc_print;
+
+use strict;
+use vars qw( %info );
+use FS::Record;
+
+%info = (
+  'name'      => 'Usage from Freeside Inc. web services',
+  'shortname' => 'Freeside web services',
+  'weight'    => '99',
+);
+
+sub price_info {
+  my $self = shift;
+  return 'printing usage';
+}
+
+sub base_setup { 0; }
+sub calc_setup { 0; }
+
+sub base_recur { 0; }
+sub calc_recur {
+  #my $self = shift;
+  #my($self, $cust_pkg, $sdate, $details, $param ) = @_;
+  my( $self, $cust_pkg ) = @_;
+
+  my $custnum = $cust_pkg->custnum;
+
+  #false laziness w/ClientAPI/Freeside.pm and webservice_log.pm
+  my $color = 1.10;
+  my $page = 0.10;
+
+  FS::Record->scalar_sql("
+    UPDATE webservice_log SET status = 'done'
+      WHERE custnum = $custnum
+        AND method = 'print'
+        AND status IS NULL 
+    RETURNING SUM ( $color + quantity * $page )
+  ");
+
+}
+
+sub can_discount { 0; }
+
+sub is_free { 0; }
+
+1;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg/fsinc_print.pm |   47 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 FS/FS/part_pkg/fsinc_print.pm




More information about the freeside-commits mailing list