Class: Contact

Contact

new Contact()

Contact class

Extends

Members

addBarcode

Adds a barcode

archive

Archive a contact

canArchive

Checks if a contact can be archived (based on status)

canCheckout

Checks if a contact can be used in a checkout (based on status)

canDelete

Checks if a contact can be deleted (based on status and link to user)

canGenerateDocument

Checks if we can generate a document for this contact (based on status)

canReserve

Checks if a contact can be used in a reservation (based on status)

canUndoArchive

Checks if a contact can be unarchived (based on status)

clearFlag

Clears the flag of an item

clearLabel

Clears the label of an item

isDirty

Checks if the base is dirty and needs saving

setFlag

Sets the flag of an item

setLabel

Sets the label of an item

undoArchive

Undo archive of a contact

updateFields

Update fields of a document

Methods

inherited addComment(comment, skipRead){promise}

Adds a comment by string

Name Type Description
comment
skipRead

inherited attach(attachmentId, skipRead){promise}

attaches an Attachment object

Name Type Description
attachmentId
skipRead

inherited clearCover(skipRead){promise}

Clears the cover image

Name Type Description
skipRead

inherited clearField(field, skipRead)

Clears a custom field

Name Type Description
field
skipRead

inherited create(skipRead){promise}

Creates an object by the default api.create

Name Type Description
skipRead

skips reading the response via _fromJson (false)

inherited delete(){promise}

Deletes an object by the default api.delete

inherited deleteComment(id, skipRead){promise}

Deletes a Comment by id

Name Type Description
id
skipRead

inherited detach(attachmentId, skipRead){promise}

detaches an Attachment by kvId (guid)

Name Type Description
attachmentId
skipRead

inherited discardChanges(){promise}

Discards any changes made to the object from the previously loaded raw response or resets it when no old raw response was found

inherited existsInDb(){boolean}

Checks if the document exists in the database

generateDocument(template, signature, skipRead){promise}

Generates a PDF document for the reservation

Name Type Description
template string

id

signature string

(base64)

skipRead bool

inherited get(_fields){promise}

Gets an object by the default api.get

Name Type Description
_fields

getUserId(){string}

If the contact is linked to a user, return its user id Remark: needs field user

getUserSync(){string}

Checks if the user is a synced user Remark: needs field user

inherited isEmpty(){boolean}

Checks if the object is empty after calling reset() isEmpty() should return true We'll only check for fields, comments, attachments here

isValid(){boolean}

Checks if the contact has any validation errors

isValidEmail(){Boolean}

Check is email is valid

isValidName(){Boolean}

Checks if name is valid

inherited reload(_fields){promise}

Reloads the object from db

Name Type Description
_fields

inherited reset(){promise}

Resets the object

inherited setCover(att, skipRead){promise}

Set the cover image to an Attachment

Name Type Description
att
skipRead

inherited setField(field, value, skipRead){promise}

Sets a custom field

Name Type Description
field
value
skipRead

inherited setFields(fields, skipRead){promise}

Sets multiple custom fields in a single call

Name Type Description
fields
skipRead

inherited update(skipRead){promise}

Updates an object by the default api.update

Name Type Description
skipRead

skips reading the response via _fromJson (false)

inherited updateComment(id, comment, skipRead){promise}

Updates a comment by id

Name Type Description
id
comment
skipRead