[freeside-commits] branch FREESIDE_4_BRANCH updated. 2aecf34ff195b9c33126f483eb96299700ec5039

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


The branch, FREESIDE_4_BRANCH has been updated
       via  2aecf34ff195b9c33126f483eb96299700ec5039 (commit)
      from  851f387f9e4a9e92625708f71f57193ad7dfbe42 (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 2aecf34ff195b9c33126f483eb96299700ec5039
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jun 13 17:00:45 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