\org_openpsa_invoices_scheduler

Helper class to process subscription invoicing

Note, that the request data, for ease of use, already contains the L10n Databases of the Component and MidCOM itself located in this class. They are stored as 'l10n' and 'l10n_midcom'. Also available as 'config' is the current component configuration.

Summary

Methods
Properties
Constants
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
run_cycle()
create_task()
calculate_cycles()
calculate_cycle_next()
get_cycle_start()
get_cycle_identifier()
$_component
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
No protected properties found
N/A
_create_at_entry()
_notify_owner()
_add_month()
$_services
$_deliverable
$subscription_day
N/A

Properties

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$_services

$_services : array

Array that holds the already instantiated services

Type

array

$subscription_day

$subscription_day : integer

The day of month on which subscriptions are invoiced (if none is set, they are invoiced continuously)

Type

integer

Methods

__get()

__get(  $field) 

Parameters

$field

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

run_cycle()

run_cycle(  $cycle_number,   $send_invoice = true) 

Initiates a new subscription cycle and registers a midcom.services.at call for the next cycle.

The subscription cycles rely on midcom.services.at. I'm not sure if it is wise to rely on it for such a totally mission critical part of OpenPSA. Some safeguards might be wise to add.

Parameters

$cycle_number
$send_invoice

create_task()

create_task(  $start,   $end,   $title,   $source_task = null) 

Parameters

$start
$end
$title
$source_task

calculate_cycles()

calculate_cycles(integer  $months = null, integer  $start = null) : integer

Calculcate remaining cycles until salesproject's end or the specified number of months passes

Parameters

integer $months

The maximum number of months to look forward

integer $start

The timestamp from which to begin

Returns

integer

calculate_cycle_next()

calculate_cycle_next(  $time) 

Parameters

$time

get_cycle_start()

get_cycle_start(  $cycle_number,   $time) 

Parameters

$cycle_number
$time

get_cycle_identifier()

get_cycle_identifier(  $time) 

Parameters

$time

_create_at_entry()

_create_at_entry(  $cycle_number,   $start) 

Parameters

$cycle_number
$start

_notify_owner()

_notify_owner(  $calculator,   $cycle_number,   $next_run,   $invoiced_sum,   $tasks_completed,   $tasks_not_completed,   $new_task = null) 

Parameters

$calculator
$cycle_number
$next_run
$invoiced_sum
$tasks_completed
$tasks_not_completed
$new_task

_add_month()

_add_month(integer  $time, integer  $offset) : \DateTime

Workaround for odd PHP DateTime behavior where for example 2012-10-31 + 1 month would return 2012-12-01. This function makes sure the new date is always in the expected month (so in the example above it would return 2012-11-30)

Parameters

integer $time

Original timestamp

integer $offset

number of months to add

Returns

\DateTime —

The new date object