Properties

$root

$root : string

The root storage folder starting at %DATA%/folder/

Type

string

$project

$project : \FAA\Obj\Generic\Project

In project context A reference to another overlaying project

Type

\FAA\Obj\Generic\Project — A project object

$prices

$prices : array<mixed,\FAA\Obj\Sys\RowPrice>

Buffer prices Storage for row prices as resolved object list.

Type

array<mixed,\FAA\Obj\Sys\RowPrice> — A list of row prices

$id

$id : 

Type

$language

$language : 

Type

$path

$path : 

Type

$type

$type : 

Type

$version

$version : 

Type

$data

$data : 

Type

$originaldata

$originaldata : 

Type

$state

$state : 

Type

$git_repo

$git_repo : 

Type

$local

$local : 

Type

$assignable

$assignable : 

Type

$recently_added

$recently_added : 

Type

$encrypted

$encrypted : null

Indicator if this is an encrypted content type

Type

null

$template

$template : null|\FAA\Obj\Generic\Template

A local instance of the assigned template

Type

null|\FAA\Obj\Generic\Template — The instance

Methods

__construct()

__construct(integer  $id = null, string  $language = null, string  $subtype = null) 

Service constructor.

Construct a new service object

Parameters

integer $id

The service id

string $language

The language to load with

string $subtype

The sub type name

Currency()

Currency() : string

Returns

string

MainProject()

MainProject() : \FAA\Obj\Generic\Project|null

Resolve the main project of this service/bill

Returns

\FAA\Obj\Generic\Project|null

AddEventEntry()

AddEventEntry(  $event) 

Parameters

$event

GetLastKnownEvent()

GetLastKnownEvent(  $type) : \FAA\Obj\Sys\Event|null

Get newest event of type

Iterate of elements list and return the newest entry

Parameters

$type

Returns

\FAA\Obj\Sys\Event|null

GeneralSearchFields()

GeneralSearchFields() : array

Get list of general search fields

Returns

array

Name()

Name() : mixed|string

Get the name and include the external reference as well

Returns

mixed|string

SearchFields()

SearchFields() : array

Return search indexer fields

Convert instance to search indexer values

Returns

array —

The search indexer fields

DateFormatted()

DateFormatted(mixed|string  $time_zone = FAA_TIMEZONE, string  $format = 'd.m.Y H:i') : string

Get the formatted date range

Parameters

mixed|string $time_zone
string $format

Returns

string

PriceList()

PriceList() : array<mixed,\FAA\Obj\Sys\RowPrice>

Price list Resolve the prices list to row price objects. This method is cached.

Returns

array<mixed,\FAA\Obj\Sys\RowPrice> —

A list of row price objects

FullPrice()

FullPrice(boolean  $format = false) : float|string

Get price Get the full gross price of this project

Parameters

boolean $format

When true as formatted string

Returns

float|string —

Either a formatted output or, the raw value

FullPriceNet()

FullPriceNet(boolean  $format = false) : float|string

Get price Get the full gross price of this project (without tax)

Parameters

boolean $format

When true as formatted string

Returns

float|string —

Either a formatted output or, the raw value

FullTax()

FullTax(boolean  $format = false) : float|string

Get tax price Get the full gross price of this project

Parameters

boolean $format

When true as formatted string

Returns

float|string —

Either a formatted output or, the raw value

ToPlainReducedObject()

ToPlainReducedObject(array  $fields, string  $language = null) : Object

Convert to reduced plain data set Translate and expose the current data attribute as plain resolved object with filtered attributes

Parameters

array $fields

List of attributes to show

string $language

A system language code or empty for raw setup

Returns

Object —

A simple attribute based php object

GetCompany()

GetCompany() : integer

Get company id Get the company id from content

Returns

integer —

The content id

GetCompanyObject()

GetCompanyObject() : \FAA\Obj\Generic\Company

Get company

Get the main company from content

Returns

\FAA\Obj\Generic\Company

A company object or null when list is empty

__get()

__get(string  $name) : mixed|null

Magic getter function

Parameters

string $name

The value name

Returns

mixed|null

GitRepo()

GitRepo() : \FAA\Git|null

Get the related git instance

Will open a git instance on demand, this method is cached locally

Returns

\FAA\Git|null

Id()

Id() : integer|string

Expose the object id

Provide an interface to extract the current id, can be numeric or string

Returns

integer|string —

The id as fixed value

Data()

Data() : array

Direct get data method

Returns

array

RecentlyAdded()

RecentlyAdded() : boolean

Was recently added

Returns

boolean

IsAssignable()

IsAssignable() : boolean|null

Is assignable Check if this is an assignable content type

Returns

boolean|null

Existing()

Existing() : boolean

Check if this instance is existing in the file system

Returns

boolean

FormattedId()

FormattedId(string  $prefix, string  $pad_string = '0', integer  $pad_length = 5, integer  $pad_type = STR_PAD_LEFT) : string

expose the formatted object id provide an interface to extract the current id with formatting options

Parameters

string $prefix

A prefix

string $pad_string

The pad character

integer $pad_length

The padding length

integer $pad_type

The padding type

Returns

string —

The formatted id

GetVersion()

GetVersion() : string

expose the GIT revision provide an interface to extract the current version hash

Returns

string —

the object version

GetLanguage()

GetLanguage() : string

expose the language provide an interface to extract the current language

Returns

string —

the object language

SetLanguage()

SetLanguage(string  $language) 

Set the language of this instance

Parameters

string $language

The language key

GetState()

GetState() : \FAA\Obj\Result

Expose the state Provide an interface to extract the current status

Returns

\FAA\Obj\Result

the object status

SetPlainAttribute()

SetPlainAttribute(string  $keys, mixed  $value) 

set a plain attribute update or add a plain attribute to this object

Parameters

string $keys

The searched attribute key

mixed $value

The new value

GetPlainOriginalAttribute()

GetPlainOriginalAttribute(string  $key, string  $language = '') : mixed

Get original value get a plain resolved attribute value from the local storage

Parameters

string $key

The searched attribute key

string $language

The searched language key or false for all

Returns

mixed —

The found value

GetPlainAttribute()

GetPlainAttribute(string  $key, string  $language = '') : mixed

get plain value get a plain resolved attribute value from the local storage

Parameters

string $key

The searched attribute key

string $language

The searched language key or false for all

Returns

mixed —

The found value

Contains()

Contains(array  $filter, string  $language = null) : boolean

Check if attribute contains the search string

Matches the filters against the given attribute selected

Parameters

array $filter

List of filters with operation, target attribute and value attr string The attribute to check op string The search operator e.g. LIKE value string The search string * matches all

string $language

The loader value to get the attributes in

Returns

boolean —

When matching true

GetType()

GetType() : string

expose the type provide an interface to extract the current type of this object

Returns

string —

the object type name

LastSaveTime()

LastSaveTime() : integer

Get save time

Expose the last save time of main object file provide an interface to extract the last save time

Returns

integer —

the object last save time

GetCreationTime()

GetCreationTime() : string|null

Get creation time

Expose the creation time of main object file provide an interface to extract the time when the file was generated or, registered in git

Returns

string|null

GetPlainOfRevision()

GetPlainOfRevision(string  $hash, boolean  $tolerate_error = false) : \FAA\Obj\Result

Fetch a certain version of a file based on the given hash

Parameters

string $hash

The git revision hash

boolean $tolerate_error

Ignore index errors on demand

Returns

\FAA\Obj\Result

A system result object

GetListOfRevisions()

GetListOfRevisions() : \FAA\Obj\Result

List versions

Load and provide a list of stored revisions for this objects. Will use git to determinate this list.

Returns

\FAA\Obj\Result

A system result object

GetRelativePath()

GetRelativePath() : string

expose the storage path provide an interface to extract the current path of this object

Returns

string —

the object storage path

StorageRoot()

StorageRoot() : string

Ger storage root Get the storage root folder, absolute

Returns

string —

The storage root folder

GetPath()

GetPath() : string

expose the storage path provide an interface to extract the current path of this object

Returns

string —

the object storage path

Delete()

Delete(boolean  $skip = false) : \FAA\Obj\Result

Do delete Delete entity from file system and git repository This method can delete this content object from our local storage system

Parameters

boolean $skip

Skip hooks on demand

Returns

\FAA\Obj\Result

A default system result set

Convert()

Convert(string  $target) : \FAA\Obj\Result

Convert to other object type

Parameters

string $target

The target name

Returns

\FAA\Obj\Result

The conversion result

Copy()

Copy(mixed  $target = null) : \FAA\Obj\Result

clone object entry in file system and git repository store the current payload inside the system storage and commit the changes to the local repository

Parameters

mixed $target

For compatibility reasons with several subtypes this argument is required

Returns

\FAA\Obj\Result

A default system result set

Save()

Save(boolean  $force_new_id = false) : \FAA\Obj\Result

Save service in file system and git repository

Will call the parent method to save the changes first. Then it checks if all bills have a version and if not, they will get the version of the previously commited service

Parameters

boolean $force_new_id

Indicate force new id on demand (local id empty)

Returns

\FAA\Obj\Result

A default system result set

ToPlainObject()

ToPlainObject(string  $language = null, boolean  $with_parent = true) : \stdClass

convert to plain data set translate and expose the current data attribute as plain resolved object

Parameters

string $language

A system language code or empty for raw setup

boolean $with_parent

When set to true the attributes will be resolved witch parent attributes included

Returns

\stdClass —

A simple attribute based php object

GetCustomerObject()

GetCustomerObject() : \FAA\Obj\Generic\Customer

Get customer

Get the sub customer from content

Returns

\FAA\Obj\Generic\Customer

A customer object or null when list is empty

UniqueTaxType()

UniqueTaxType() : string

Get the unique tax type identification

Returns

string

FormattedBillNumber()

FormattedBillNumber() : string

Get bill number

Get the formatted bill number with pad left and prefix

Returns

string —

The formatted bill number

FormattedOfferNumber()

FormattedOfferNumber() : string

Get a formatted offer number

Returns

string

IsRecurring()

IsRecurring() : boolean

Has recurring

Check if this service has a interval

Returns

boolean —

Indicate if this service has recurring entries

CreateMissingBills()

CreateMissingBills(\FAA\Obj\Generic\Project  $project, boolean  $force = false) : \FAA\Obj\Result

Create the missing bill entries

Build the pdfs of all bills that are not available locally

Parameters

\FAA\Obj\Generic\Project $project

The parent project

boolean $force

Force re rendering of bill

Returns

\FAA\Obj\Result

The render result

GetBillPdfs()

GetBillPdfs(\FAA\Obj\Generic\Project  $project, null  $date_from = null, null  $date_to = null) : \FAA\Obj\Result

Get all bill pdf files for a certain time frame in a project context

Parameters

\FAA\Obj\Generic\Project $project

The parent project

null $date_from

Filter date from

null $date_to

Filter date to

Returns

\FAA\Obj\Result

The fetch result

Bill()

Bill(string  $number) : mixed|null

Get a certain bill link attribute

Parameters

string $number

Returns

mixed|null —

The found bill

Bills()

Bills(null  $date_from = null, null  $date_to = null) : array

Get the bills

Parameters

null $date_from

Filter date from

null $date_to

Filter date to

Returns

array —

The list of bills

LastPayedDate()

LastPayedDate() : false|integer

Get the last payed timestamp

Returns

false|integer

AllBillsPayed()

AllBillsPayed() : boolean

Are all the bills payed?

Returns

boolean

SetAllBillsPayed()

SetAllBillsPayed() : \FAA\Obj\Result

Set all bills tpo payed

Returns

\FAA\Obj\Result

GetTemplate()

GetTemplate(string  $name = 'template') : \FAA\Obj\Generic\Template

Load template

Helper method to load the assigned template and return as object. This one is cached locally.

Parameters

string $name

Type of template to fetch

Returns

\FAA\Obj\Generic\Template

A system template object covered in a result object

ServiceToOffer()

ServiceToOffer(string  $language = null, \FAA\Obj\Generic\Project  $project = null) : \FAA\Obj\Result

Get the offer pdf

Generates the offer pdf file based on the defined template nd the given language

Parameters

string $language

The target language

\FAA\Obj\Generic\Project $project

The parent project

Returns

\FAA\Obj\Result

The result

SendOfferToCustomer()

SendOfferToCustomer(string  $language = null) : \FAA\Obj\Result

Send offer mail

Send the offer email to the defined emailaddress of the assigned customer

Parameters

string $language

A language key

Returns

\FAA\Obj\Result

A system result object

SendBillToCustomer()

SendBillToCustomer(string  $language = null) : \FAA\Obj\Result

Send the bill to the customer

Creates the mail object based on the configuration and send it to the customer

Parameters

string $language

The template language

Returns

\FAA\Obj\Result

The send result

RegisterBillNumber()

RegisterBillNumber(\FAA\Obj\Generic\Project  $project) : \FAA\Obj\Result

Register a new billing number to the service on demand

Checks if the service has bills and adds new ones when not and not recurring. When it has not and recurring property flag is set, it will either reuse the locked number of the bill item or, create a new bill item with new number. The date will be set either to the date from or the next bill date.

This method does saves the service on demand and therefor commits at least one file to the database.

Parameters

\FAA\Obj\Generic\Project $project

The parent project object

Returns

\FAA\Obj\Result

A system result object

CreateBill()

CreateBill(\FAA\Obj\Generic\Project  $project, string  $version = null, string  $number = null) : \FAA\Obj\Result

Create a bill

Create a pdf bill and return the download path. When a version is given this will cause an sym link operation to a newly loaded version of this service.

Parameters

\FAA\Obj\Generic\Project $project

A project object

string $version

A certain version to generate the bill for

string $number

A certain number in the bill list (requires resolve of version)

Returns

\FAA\Obj\Result

A default system result object

BillPreview()

BillPreview(\FAA\Obj\Generic\Project  $project, string  $number = null) : \FAA\Obj\Result

Get preview for certain bill or in general

Parameters

\FAA\Obj\Generic\Project $project

The parent project

string $number

The bill number or null

Returns

\FAA\Obj\Result

loadFromSrcCached()

loadFromSrcCached() 

Load the instance values from storage

loadFromSrc()

loadFromSrc() 

Load data from source

Fetch the content master file for this entry by given path The data will be stored in the local data property, when the data is encrypted it will be locally decrypted This function has not return value but a side effect on status. It will handle the cases when an entity is encryped in a transparent way

GetNextOfSequence()

GetNextOfSequence() 

Get next id Load a new id from buffer and set it as primary key

Has side effect to set the local states

setPlainSubAttribute()

setPlainSubAttribute(array  $target, mixed  $value, string  $path) 

set a sub attribute update or add a plain attribute to this object this method will resolve the . separated path until the end of the limb is reached and $this->data was updated

Parameters

array $target

A reference tho the this->data branch the update is target of

mixed $value

The new value

string $path

The remaining path components to target

endDate()

endDate() : string|null

The ending date for this service

Returns

string|null

getBill()

getBill(  $number) : mixed|null

Gt a single bill by number

Parameters

$number

Returns

mixed|null