new Transaction()
Properties:
Name | Type | Description |
---|---|---|
autoCleanup |
boolean | Automatically cleanup the transaction if it becomes empty? |
dateHelper |
DateHelper | A DateHelper object ref |
status |
string | The transaction status |
from |
moment | The transaction from date |
to |
moment | The transaction to date |
due |
moment | The transaction due date |
number |
string | The booking number |
contact |
string | The Contact.id for this transaction |
location |
string | The Location.id for this transaction |
items |
Array | A list of Item.id strings |
conflicts |
Array | A list of conflict hashes |
Extends
Members
-
addBarcode
-
Adds a barcode
-
archive
-
Archive a transaction
-
canArchive
-
Checks if we can archive a transaction (based on status)
-
canUndoArchive
-
Checks if we can unarchive a transaction (based on status)
-
clearFlag
-
Clears the flag of an item
-
clearLabel
-
Clears the label of an item
-
setFlag
-
Sets the flag of an item
-
setLabel
-
Sets the label of an item
-
undoArchive
-
Undo archive of a transaction
-
updateFields
-
Update fields of a document
Methods
-
Adds a comment by string
Name Type Description comment
skipRead
-
addItems(items, skipRead){promise}
-
addItems; adds a bunch of Items to the transaction using a list of item ids It creates the transaction if it doesn't exist yet
Name Type Description items
skipRead
-
attaches an Attachment object
Name Type Description attachmentId
skipRead
-
Checks via the api if we can delete the document
-
clearContact(skipRead){promise}
-
Clears the contact for this transaction
Name Type Description skipRead
skip parsing the returned json response into the transaction
-
Clears the cover image
Name Type Description skipRead
-
clearDueDate(skipRead){promise}
-
Clear the transaction due date
Name Type Description skipRead
-
Clears a custom field
Name Type Description field
skipRead
-
clearFromDate(skipRead){promise}
-
Clear the transaction from date
Name Type Description skipRead
-
clearItems(skipRead){promise}
-
clearItems; removes all Items from the transaction It deletes the transaction if it's empty afterwards and autoCleanup is true
Name Type Description skipRead
-
clearLocation(skipRead){promise}
-
Clears the location for this transaction
Name Type Description skipRead
skip parsing the returned json response into the transaction
-
clearName(skipRead){promise}
-
Clears transaction name
Name Type Description skipRead
skip parsing the returned json response into the transaction
-
clearToDate(skipRead){promise}
-
Clear the transaction to date
Name Type Description 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
-
Deletes a Comment by id
Name Type Description id
skipRead
-
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
-
inherited get(_fields){promise}
-
Gets an object by the default api.get
Name Type Description _fields
-
getMaxDate(){Moment}
-
DEPRECATED Gets the latest possible date to end this transaction
Returns:
date
-
getMaxDateDue(){Moment}
-
Gets the highest possible due date, by default same as getMaxDateDue
-
getMaxDateFrom(){Moment}
-
Gets the highest possible from date, by default years from now
-
getMaxDateTo(){Moment}
-
Gets the highest possible to date, by default years from now
-
getMinDate(){Moment}
-
DEPRECATED Gets the lowest possible date to start this transaction
Returns:
date
-
getMinDateDue(){Moment}
-
Gets the lowest possible due date, by default same as getMinDateTo
-
getMinDateFrom(){Moment}
-
Gets the lowest possible from date, by default now
-
getMinDateTo(){Moment}
-
Gets the lowest possible to date, by default from +1 timeslot
-
hasItems(itemIds){Array}
-
hasItems; Gets a list of items that are already part of the transaction
Name Type Description itemIds
array of string values
-
isDirty(){boolean}
-
Checks if the transaction is dirty and needs saving
-
isEmpty(){boolean}
-
Checks if the transaction is empty
-
inherited isValid(){boolean}
-
Checks if the object is valid
-
inherited reload(_fields){promise}
-
Reloads the object from db
Name Type Description _fields
-
removeItems(items, skipRead){promise}
-
removeItems; removes a bunch of Items from the transaction using a list of item ids It deletes the transaction if it's empty afterwards and autoCleanup is true
Name Type Description items
skipRead
-
inherited reset(){promise}
-
Resets the object
-
setContact(contactId, skipRead){promise}
-
Sets the contact for this transaction
Name Type Description contactId
skipRead
skip parsing the returned json response into the transaction
-
Set the cover image to an Attachment
Name Type Description att
skipRead
-
setDueDate(date, skipRead){promise}
-
Set the transaction due date
Name Type Description date
skipRead
-
Sets a custom field
Name Type Description field
value
skipRead
-
Sets multiple custom fields in a single call
Name Type Description fields
skipRead
-
setFromDate(date, skipRead){promise}
-
Sets the transaction from date
Name Type Description date
skipRead
-
setLocation(locationId, skipRead){promise}
-
Sets the location for this transaction
Name Type Description locationId
skipRead
skip parsing the returned json response into the transaction
-
setName(name, skipRead){promise}
-
Sets transaction name
Name Type Description name
skipRead
skip parsing the returned json response into the transaction
-
setToDate(date, skipRead){promise}
-
Sets the transaction to date
Name Type Description date
skipRead
-
suggestEndDate(m){*}
-
suggestEndDate, makes a new moment() object with a suggested end date, already rounded up according to the group.profile settings
Name Type Description m
Moment a suggested end date for this transaction
-
swapItem(fromItem, toItem, skipRead){promise}
-
swapItem; swaps one item for another in a transaction
Name Type Description fromItem
toItem
skipRead
-
inherited update(skipRead){promise}
-
Updates an object by the default api.update
Name Type Description skipRead
skips reading the response via _fromJson (false)
-
Updates a comment by id
Name Type Description id
comment
skipRead