- web interface for hourly account charges!
[freeside.git] / httemplate / docs / man / FS / cust_pkg.html
index 459d129..9f1005d 100644 (file)
@@ -53,6 +53,8 @@
 <PRE>
   @labels = $record-&gt;labels;</PRE>
 <PRE>
+  $seconds = $record-&gt;seconds_since($timestamp);</PRE>
+<PRE>
   $error = FS::cust_pkg::order( $custnum, \@pkgparts );
   $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );</PRE>
 <P>
@@ -79,6 +81,9 @@ inherits from FS::Record.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_taker">otaker - order taker (assigned automatically if null, see <A HREF=".././FS/UID.html">the FS::UID manpage</A>)</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_manual_flag_%2D_If_this_field_is_set_to_1%2C_disab">manual_flag - If this field is set to 1, disables the automatic
+unsuspension of this package when using the <STRONG>unsuspendauto</STRONG> config file.</A></STRONG><BR>
+<DD>
 </DL>
 <P>Note: setup, bill, susp, expire and cancel are specified as UNIX timestamps;
 see <EM>perlfunc/``time''</EM>.  Also see <A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for
@@ -95,26 +100,12 @@ Create a new billing item.  To add the item to the database, see <A HREF="#inser
 <DD>
 Adds this billing item to the database (``Orders'' the item).  If there is an
 error, returns the error, otherwise returns false.
-<P>sub insert {
-  my $self = shift;</P>
-<PRE>
-  # custnum might not have have been defined in sub check (for one-shot new
-  # customers), so check it here instead</PRE>
-<PRE>
-  my $error = $self-&gt;ut_number('custnum');
-  return $error if $error</PRE>
-<PRE>
-  return &quot;Unknown customer&quot;
-    unless qsearchs( 'cust_main', { 'custnum' =&gt; $self-&gt;custnum } );</PRE>
-<PRE>
-  $self-&gt;SUPER::insert;</PRE>
-<P>}</P>
 <P></P>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
-Currently unimplemented.  You don't want to delete billing items, because there
-would then be no record the customer ever purchased the item.  Instead, see
-the cancel method.
+This method now works but you probably shouldn't use it.
+<P>You don't want to delete billing items, because there would then be no record
+the customer ever purchased the item.  Instead, see the cancel method.</P>
 <P></P>
 <DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
 <DD>
@@ -158,16 +149,32 @@ package, then unsuspends the package itself (clears the susp field).
 Returns the definition for this billing item, as an FS::part_pkg object (see
 <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>).
 <P></P>
+<DT><STRONG><A NAME="item_cust_svc">cust_svc</A></STRONG><BR>
+<DD>
+Returns the services for this package, as FS::cust_svc objects (see
+<A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>)
+<P></P>
 <DT><STRONG><A NAME="item_labels">labels</A></STRONG><BR>
 <DD>
 Returns a list of lists, calling the label method for all services
 (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) of this billing item.
+<P></P>
+<DT><STRONG><A NAME="item_cust_main">cust_main</A></STRONG><BR>
+<DD>
+Returns the parent customer object (see <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>).
+<P></P>
+<DT><STRONG><A NAME="item_seconds_since_TIMESTAMP">seconds_since TIMESTAMP</A></STRONG><BR>
+<DD>
+Returns the number of seconds all accounts (see <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>) in this
+package have been online since TIMESTAMP.
+<P>TIMESTAMP is specified as a UNIX timestamp; see <EM>perlfunc/``time''</EM>.  Also see
+<A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for conversion functions.</P>
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="subroutines">SUBROUTINES</A></H1>
 <DL>
-<DT><STRONG><A NAME="item_order_CUSTNUM%2C_PKGPARTS_ARYREF%2C_%5B_REMOVE_PKG">order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]</A></STRONG><BR>
+<DT><STRONG><A NAME="item_order_CUSTNUM%2C_PKGPARTS_ARYREF%2C_%5B_REMOVE_PKG">order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF [ RETURN_CUST_PKG_ARRAYREF ] ]</A></STRONG><BR>
 <DD>
 CUSTNUM is a customer (see <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>)
 <P>PKGPARTS is a list of pkgparts specifying the the billing item definitions (see
@@ -176,12 +183,15 @@ permitted.</P>
 <P>REMOVE_PKGNUMS is an optional list of pkgnums specifying the billing items to
 remove for this customer.  The services (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) are moved to the
 new billing items.  An error is returned if this is not possible (see
-<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>).</P>
+<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>).  An empty arrayref is equivalent to not specifying this
+parameter.</P>
+<P>RETURN_CUST_PKG_ARRAYREF, if specified, will be filled in with the
+newly-created cust_pkg objects.</P>
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_pkg.html,v 1.2 2002-01-29 16:33:15 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -194,11 +204,13 @@ compile time, rather than via 'require' in sub { setup, suspend, unsuspend,
 cancel } because they use %FS::UID::callback to load configuration values.
 Probably need a subroutine which decides what to do based on whether or not
 we've fetched the user yet, rather than a hash.  See FS::UID and the TODO.</P>
+<P>Now that things are transactional should the check in the insert method be
+moved to check ?</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>, <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>
-<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>, schema.html from the base documentation</P>
+<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>, <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>,
+<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>, schema.html from the base documentation</P>
 
 </BODY>