Helper class to process subscription invoicing

package org.openpsa.invoices

 Methods

__construct (\org_openpsa_sales_salesproject_deliverable_dba $deliverable)

Parameters

$deliverable

calculate_cycle_next ($time)

Parameters

$time

calculate_cycles ($months)

Parameters

$months

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

todo Check if we already have an open task for this delivery?

Parameters

$start

$end

$title

$source_task

get_cycle_identifier ($time)

Parameters

$time

get_cycle_start ($cycle_number, $time)

Parameters

$cycle_number

$time

run_cycle ($cycle_number, $send_invoice)

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

_add_month (integer $time, integer $offset)

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 exoected month (so in the example above it would return 2012-11-30)

Parameters

$time

integerOriginal timestamp

$offset

integernumber of months to add

Returns

\DateTimeThe new date object

_create_at_entry ($cycle_number, $start)

Parameters

$cycle_number

$start

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

Parameters

$calculator

$cycle_number

$next_run

$invoiced_sum

$tasks_completed

$tasks_not_completed

$new_task

 Properties

 

\org_openpsa_sales_salesproject_deliverable_dba $_deliverable

The deliverable we're processing