FileAccess Orion

Services extends Master
in package
implements WithConfig, WithIncludes

Services widget

Implement interfaces to handle the projects and services. This can be used for recurring billings and project billing + management

Tags
category

Kernel

author

Tobias Teichner webmaster@teichner.biz

since

File available since v0.143

Interfaces, Classes, Traits and Enums

WithConfig
Define implementation details for 3 configuration related endpoints
WithIncludes

Table of Contents

$request  : Request|null
$endpoint  : Endpoint|null
$response  : Response|null
$setup  : Widget|null
$git_repo  : array<string|int, mixed>
$is_dev_mode  : bool
Enable for some bypasses in dev mode
$preview_types  : array<string|int, mixed>
$root  : string
The root storage folder starting at %DATA%/folder/
$root_dir  : string
The basket root directory
$task_root  : string
root storage folder starting at %DATA%/folder/
__construct()  : mixed
Needs to be there even if it is empty
AddBillTemplate()  : void
ArticleSales()  : void
AvailableServiceTypes()  : void
Chart()  : void
ConvertServiceToOrder()  : void
CreateAndPayServiceBill()  : void
CreateServiceBill()  : void
CreateServiceOffer()  : void
DownloadBillFile()  : void
DropBillTemplate()  : void
Endpoint()  : Endpoint|null
Get/Set endpoint
ExportBills()  : void
FetchBillTemplate()  : void
GetBillNumber()  : void
GetConfig()  : void
Endpoint handler to fetch the config
GetConfigPreset()  : void
Endpoint handler to get the config data form template
GetTreeLimb()  : void
GitRepo()  : Git
Git object
ImportBills()  : void
InitialCall()  : void
LoadCustomer()  : void
LoadEmailTemplateList()  : void
ProjectAdd()  : void
ProjectDrop()  : void
ProjectLoad()  : void
ProjectUpdate()  : void
RegisterBillCronjob()  : void
RegisterIncludes()  : array<string|int, mixed>
Register includes on add the widget to certain page
Request()  : Request
The request Sets or gets the widget request object
ResourceFetch()  : void
Response()  : Response
Response object Get / Set the widget response
SaveConfig()  : void
Endpoint handler to update the config
SearchBillTemplate()  : void
SearchCompany()  : void
SearchCompanyFormFill()  : mixed
SearchCustomer()  : void
SearchResources()  : void
SearchResourcesCalendar()  : void
SearchSubService()  : void
SendServiceBill()  : void
SendServiceDeliveryNote()  : void
SendServiceOffer()  : void
ServiceAdd()  : void
ServiceChangeStatus()  : void
ServiceCopy()  : void
ServiceDrop()  : void
ServiceList()  : void
ServiceLoad()  : void
ServiceLoadChanges()  : void
ServiceMove()  : void
ServiceTaskCreate()  : void
ServiceTaskDrop()  : void
ServiceTaskLoad()  : void
ServiceTaskLoadSingle()  : void
ServiceTaskUpdate()  : void
ServiceUpdate()  : void
Setup()  : Widget|null
Get/Set the widget context
SpecPreview()  : void
UpdateBillTemplate()  : void
ConfigGet()  : void
Get a configuration by name
ConfigGetPreset()  : void
Get the configuration preset data
ConfigGetRaw()  : Result
Get configuration data as object from setup handler
ConfigSave()  : void
Store a configuration with values from body and a given name
CopyEntity()  : void
copy a single content links the frontend to the copy handler for single contents identified by rest end point argument
CreateEntity()  : mixed
create new object
deleteEntity()  : void
Delete a single content
fetchAssignedEntityList()  : mixed
fetchEntityList()  : void
Fetch list of entries Use the direct loader method to retrieve a list obf objects
fetchEntityListFiltered()  : void
Fetch filtered list
fetchObject()  : BaseContent|bool|null
Retrieve an object from storage
handleSubViewList()  : mixed
Handle the list/object loading for sub view of contents
loadSingleEntity()  : void
load a single content implements the loader for single contents identified by rest end point argument
prepareObjectLogs()  : void
Prepare the object comment and arguments for changes in diff
UpdateEntity()  : void
Update a single content
checkProjectAccessLevel()  : Project|null
Check access Check if user has access and if user has the additional company access when the user is no admin
filterTree()  : array<string|int, mixed>
Filter tree Recursive filtering of folder tree list by user companies
findSkonto()  : array<string|int, mixed>|null
getProject()  : Project|null
Load project Load the project by given query string
getService()  : Service|BaseBill
get service Load a raw service element
inRange()  : bool
Test if certain item is in requested time range
loadProject()  : Project|null
Load project Load the project by given query string
loadServices()  : array<string|int, mixed>|null
Load services and(on demand bills to display them
openService()  : Service|null
Open a service in the context of a project
resolveRequestArguments()  : stdClass
Parse the interface arguments Get path to project and relevant service relation id

Properties

$git_repo

private array<string|int, mixed> $git_repo = array()

$is_dev_mode

Enable for some bypasses in dev mode

private bool $is_dev_mode = true

$preview_types

private array<string|int, mixed> $preview_types = ['png', 'jpg', 'tiff', 'jpeg', 'bmp', 'svg', 'tiff', 'gif']

$root

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

private string $root = 'media/projects/'

$root_dir

The basket root directory

private string $root_dir = 'media/storage/'

$task_root

root storage folder starting at %DATA%/folder/

private string $task_root = 'media/tasks/'

Methods

__construct()

Needs to be there even if it is empty

public __construct() : mixed
Return values
mixed

AddBillTemplate()

public AddBillTemplate() : void
Return values
void

ArticleSales()

public ArticleSales() : void
Return values
void

AvailableServiceTypes()

public AvailableServiceTypes() : void
Return values
void

Chart()

public Chart() : void
Return values
void

ConvertServiceToOrder()

public ConvertServiceToOrder() : void
Return values
void

CreateAndPayServiceBill()

public CreateAndPayServiceBill() : void
Return values
void

CreateServiceBill()

public CreateServiceBill() : void
Return values
void

CreateServiceOffer()

public CreateServiceOffer() : void
Return values
void

DownloadBillFile()

public DownloadBillFile() : void
Return values
void

DropBillTemplate()

public DropBillTemplate() : void
Return values
void

Endpoint()

Get/Set endpoint

public Endpoint([Endpoint|null $endpoint = null ]) : Endpoint|null

Sets or gets the widget arguments, they contain the endpoint this widget was called at

Parameters
$endpoint : Endpoint|null = null

A system request list

Return values
Endpoint|null

A system endpoint object

ExportBills()

public ExportBills() : void
Return values
void

FetchBillTemplate()

public FetchBillTemplate() : void
Return values
void

GetBillNumber()

public GetBillNumber() : void
Return values
void

GetConfig()

Endpoint handler to fetch the config

public GetConfig() : void
Return values
void

GetConfigPreset()

Endpoint handler to get the config data form template

public GetConfigPreset() : void
Return values
void

GetTreeLimb()

public GetTreeLimb() : void
Return values
void

GitRepo()

Git object

public GitRepo([string $path = 'data' ]) : Git

Gets the widget git instance, either for config or, for data repo

Parameters
$path : string = 'data'

The target repo, default is data

Return values
Git

A system git object with data folder as start point

ImportBills()

public ImportBills() : void
Return values
void

InitialCall()

public InitialCall() : void
Return values
void

LoadCustomer()

public LoadCustomer() : void
Return values
void

LoadEmailTemplateList()

public LoadEmailTemplateList() : void
Return values
void

ProjectAdd()

public ProjectAdd() : void
Return values
void

ProjectDrop()

public ProjectDrop() : void
Return values
void

ProjectLoad()

public ProjectLoad() : void
Return values
void

ProjectUpdate()

public ProjectUpdate() : void
Return values
void

RegisterBillCronjob()

public RegisterBillCronjob() : void
Return values
void

RegisterIncludes()

Register includes on add the widget to certain page

public RegisterIncludes(Request $request) : array<string|int, mixed>
Parameters
$request : Request
Tags
inheritDoc
Return values
array<string|int, mixed>

Request()

The request Sets or gets the widget request object

public Request([Request|null $request = null ]) : Request
Parameters
$request : Request|null = null

A system request object

Return values
Request

A system request object

ResourceFetch()

public ResourceFetch() : void
Return values
void

Response()

Response object Get / Set the widget response

public Response([Response|null $response = null ]) : Response
Parameters
$response : Response|null = null
Return values
Response

A system response object

SaveConfig()

Endpoint handler to update the config

public SaveConfig() : void
Return values
void

SearchBillTemplate()

public SearchBillTemplate() : void
Return values
void

SearchCompany()

public SearchCompany() : void
Return values
void

SearchCompanyFormFill()

public SearchCompanyFormFill() : mixed
Return values
mixed

SearchCustomer()

public SearchCustomer() : void
Return values
void

SearchResources()

public SearchResources() : void
Return values
void

SearchResourcesCalendar()

public SearchResourcesCalendar() : void
Return values
void

SearchSubService()

public SearchSubService([array<string|int, mixed>|null $given = null ]) : void
Parameters
$given : array<string|int, mixed>|null = null
Return values
void

SendServiceBill()

public SendServiceBill() : void
Return values
void

SendServiceDeliveryNote()

public SendServiceDeliveryNote() : void
Return values
void

SendServiceOffer()

public SendServiceOffer() : void
Return values
void

ServiceAdd()

public ServiceAdd([array<string|int, mixed>|null $path = null ]) : void
Parameters
$path : array<string|int, mixed>|null = null
Return values
void

ServiceChangeStatus()

public ServiceChangeStatus() : void
Return values
void

ServiceCopy()

public ServiceCopy() : void
Return values
void

ServiceDrop()

public ServiceDrop() : void
Return values
void

ServiceList()

public ServiceList() : void
Return values
void

ServiceLoad()

public ServiceLoad() : void
Return values
void

ServiceLoadChanges()

public ServiceLoadChanges() : void
Return values
void

ServiceMove()

public ServiceMove() : void
Return values
void

ServiceTaskCreate()

public ServiceTaskCreate() : void
Return values
void

ServiceTaskDrop()

public ServiceTaskDrop() : void
Return values
void

ServiceTaskLoad()

public ServiceTaskLoad() : void
Return values
void

ServiceTaskLoadSingle()

public ServiceTaskLoadSingle() : void
Return values
void

ServiceTaskUpdate()

public ServiceTaskUpdate() : void
Return values
void

ServiceUpdate()

public ServiceUpdate() : void
Return values
void

Setup()

Get/Set the widget context

public Setup([Widget|null $setup = null ]) : Widget|null
Parameters
$setup : Widget|null = null
Return values
Widget|null

SpecPreview()

public SpecPreview() : void
Return values
void

UpdateBillTemplate()

public UpdateBillTemplate() : void
Return values
void

ConfigGet()

Get a configuration by name

protected ConfigGet(string $name) : void
Parameters
$name : string

The name of the config file

Return values
void

ConfigGetPreset()

Get the configuration preset data

protected ConfigGetPreset(string $name) : void
Parameters
$name : string

The name of the config file

Return values
void

ConfigGetRaw()

Get configuration data as object from setup handler

protected ConfigGetRaw(string $name) : Result
Parameters
$name : string

The name of the config file

Return values
Result

ConfigSave()

Store a configuration with values from body and a given name

protected ConfigSave(string $name) : void
Parameters
$name : string

The name of the config file

Return values
void

CopyEntity()

copy a single content links the frontend to the copy handler for single contents identified by rest end point argument

protected CopyEntity(array<string|int, mixed>|string $type, int|string $epIndex) : void
Parameters
$type : array<string|int, mixed>|string

The requested content type

$epIndex : int|string

Parse this parameter as id

Return values
void

CreateEntity()

create new object

protected CreateEntity(string $type) : mixed

this method creates a new instance of a specific system content type

Parameters
$type : string

A registered system content type

Return values
mixed

deleteEntity()

Delete a single content

protected deleteEntity(string|array<string|int, string> $type, int|string $epIndex) : void

Implements the delete handler for single contents identified by rest end point argument

Parameters
$type : string|array<string|int, string>

The requested content type

$epIndex : int|string

Parse this parameter as id

Return values
void

fetchAssignedEntityList()

protected fetchAssignedEntityList( $list[, null $language = null ]) : mixed
Parameters
$list :
$language : null = null
Tags
deprecated

This method is obsolete and a relic from a certain project

Return values
mixed

fetchEntityList()

Fetch list of entries Use the direct loader method to retrieve a list obf objects

protected fetchEntityList(string $type[, bool $raw = false ]) : void
Parameters
$type : string

Fetch list of elements

$raw : bool = false

Return as raw object and not plain

Return values
void

fetchEntityListFiltered()

Fetch filtered list

protected fetchEntityListFiltered(string|array<string|int, string> $type[, array<string|int, mixed>|null $extra_payload = null ]) : void

Implements the server side data tables processing functions Supports free text search, paging and ordering at the moment

Parameters
$type : string|array<string|int, string>

The requested content type(s)

$extra_payload : array<string|int, mixed>|null = null

Additional filter operators

Return values
void

fetchObject()

Retrieve an object from storage

protected fetchObject(int|string $id, string|array<string|int, string> $type[, string $right = 'view' ]) : BaseContent|bool|null

Load a single content from storage as instance If object was not found it will set the 404 error code

Parameters
$id : int|string

A object id

$type : string|array<string|int, string>

A object type

$right : string = 'view'

An access level to test against

Return values
BaseContent|bool|null

A base content or null when not found or false when not access

handleSubViewList()

Handle the list/object loading for sub view of contents

protected handleSubViewList(array<string|int, mixed> $payload) : mixed
Parameters
$payload : array<string|int, mixed>

The request payload parent_type string Name of the parent type to manage inside parent string/int The id of the parent content attr string The attribute name to manage type string Type of the content to assign elements array List of elements when type is __multi content int Id when a direct content edit is performed (e.g. in child contents)

Tags
deprecated

This method is deprecated

Return values
mixed

loadSingleEntity()

load a single content implements the loader for single contents identified by rest end point argument

protected loadSingleEntity(string $type, int|string $epIndex[, string|null $language = null ]) : void
Parameters
$type : string

The requested content type

$epIndex : int|string

Parse this parameter as id

$language : string|null = null

Language code to fetch element in

Return values
void

prepareObjectLogs()

Prepare the object comment and arguments for changes in diff

protected prepareObjectLogs(BaseContent $item) : void
Parameters
$item : BaseContent
Return values
void

UpdateEntity()

Update a single content

protected UpdateEntity(string|array<string|int, string> $type, int|string $epIndex[, bool $return = false ]) : void

Implements the update handler for single contents identified by rest end point argument Does return the values when config option says so

Parameters
$type : string|array<string|int, string>

The requested content type or, a list of allowed types

$epIndex : int|string

Parse this parameter as id

$return : bool = false
Return values
void

checkProjectAccessLevel()

Check access Check if user has access and if user has the additional company access when the user is no admin

private checkProjectAccessLevel(string $path, string $general_action) : Project|null
Parameters
$path : string

The request path

$general_action : string

The right to test against (view, edit, drop)

Return values
Project|null

The project or null

filterTree()

Filter tree Recursive filtering of folder tree list by user companies

private filterTree(array<string|int, mixed> $items, array<string|int, mixed> $companies) : array<string|int, mixed>
Parameters
$items : array<string|int, mixed>

A list of folder objects

$companies : array<string|int, mixed>

A list of company ids

Return values
array<string|int, mixed>

A list of filtered folder objects

findSkonto()

private findSkonto(array<string|int, mixed> $st, string $date_from) : array<string|int, mixed>|null
Parameters
$st : array<string|int, mixed>
$date_from : string
Return values
array<string|int, mixed>|null

getProject()

Load project Load the project by given query string

private getProject(string $path, string $mode) : Project|null
Parameters
$path : string

The relative project path

$mode : string

The right to test against

Return values
Project|null

A project object or null when not found

getService()

get service Load a raw service element

private getService(string $id, string $sub_type) : Service|BaseBill
Parameters
$id : string

A service primary

$sub_type : string

The service sub type name

Return values
Service|BaseBill

A service object or null

inRange()

Test if certain item is in requested time range

private inRange(string|null $range_from, string|null $range_to, string|null $item_from, string|null $item_to) : bool
Parameters
$range_from : string|null
$range_to : string|null
$item_from : string|null
$item_to : string|null
Return values
bool

loadProject()

Load project Load the project by given query string

private loadProject(string|null $mode) : Project|null
Parameters
$mode : string|null

The right to test against

Return values
Project|null

A project object or null when not found

loadServices()

Load services and(on demand bills to display them

private loadServices([array<string|int, mixed>|null $filter = null ][, bool $include_bills = false ]) : array<string|int, mixed>|null
Parameters
$filter : array<string|int, mixed>|null = null
$include_bills : bool = false
Return values
array<string|int, mixed>|null

openService()

Open a service in the context of a project

private openService([string $right = 'view' ]) : Service|null
Parameters
$right : string = 'view'

The requested permission

Return values
Service|null

resolveRequestArguments()

Parse the interface arguments Get path to project and relevant service relation id

private resolveRequestArguments([bool $remove_last = true ]) : stdClass
Parameters
$remove_last : bool = true

Pop last part of path e.g. "/changes"

Return values
stdClass

The path and id

Search results