Module "invoice_contact"
Description
Invoice Contact Module
This module allows you to create, update and retrieve your invoice
contacts. Invoice contacts are the information associated with
invoices and should always contain your up-to-date information.
Note that, when updating an invoice contact, associated invoices
will NOT be changed.
Available methods
- void delete
- array get_by_id
- array get_by_reseller
- array get_by_user
- int insert
- void update
- array validate
Details
void delete
Delete an invoice contact. Remember that your information is
not really deleted, but rather marked as deleted. The linked
information needs to be preserved for bookkeeping.
Parameters
- int $id The invoice contact ID to delete
array get_by_id
Retrieve an invoice contact by supplying its ID
Parameters
- int $id The invoice contact ID
Returns
- array $info Array containing all the invoice information
array get_by_reseller
Retrieve all invoice contacts assodiated to a reseller. These
contacts are the ones used to create our invoices towards
resellers.
Parameters
- int $reseller_id The reseller ID for which to get invoice contacts
Returns
- array $invoice_contacts An array containing all the invoice contact information
array get_by_user
Retrieve all invoice contacts associated to a user. The
returned array contains all information for these invoice
contacts.
Parameters
- int $user_id The user ID to get invoice contacts for
Returns
- array $invoice_contacts An array containing all the invoice contact information
int insert
Create a new \invoice contact. The supplied details array should
contain the following fields:
- user_id OR reseller_id to which the contact belongs to
- firstname
- lastname
- company
- street
- nr
- city
- zipcode
- state
- country_id
- language_id
- phone
- fax
- gsm
- email
- vat
Parameters
- array $details The details to create the contact with
Returns
- int $id The ID of the new \invoice contact
void update
Update an existing invoice contact with the given details. The
existing invoice contact will not be overwritten, but a new \one
will be created and the old one marked as deleted.
The supplied details array should contain the following fields:
- user_id OR reseller_id to which the contact belongs to
- firstname
- lastname
- company
- street
- nr
- city
- zipcode
- state
- country_id
- language_id
- phone
- fax
- gsm
- email
- vat
Parameters
- int $id The invoice contact ID to update
- array $details The details to update the contact with
array validate
Validate an invoice contact before submitting it for insertion
or updating.
Note that although an ID is required, if you supply 0 as the ID
the given details will be evaluated against a blank instance,
just as if you were creating a new \one.
If a valid ID is supplied, your details will be merged and
then evaluated, just like for updates.
Parameters
- int $id The invoice contact ID to update, submit 0 for none
- array $details The details to evaluate
Returns
- array $errors An array containing all the errors found in the supplied contact