Class: Order

Order

Order

new Order()

Extends

Members

addBarcode

Adds a barcode

archive

Archive a transaction

canArchive

Checks if we can archive a transaction (based on status)

canGenerateDocument

Checks if we can generate a document for this order (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

isValidDueDate

Checks if due date is valid for an creating order oterwise return true

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

inherited addComment(comment, skipRead){promise}

Adds a comment by string

Name Type Description
comment
skipRead

inherited 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

inherited attach(attachmentId, skipRead){promise}

attaches an Attachment object

Name Type Description
attachmentId
skipRead

canAddItems(){boolean}

Checks if items can be added to the checkout (based on status)

canCheckin(){boolean}

Checks if order can be checked in

canCheckout(){boolean}

Checks if order can be checked out

canDelete(){boolean}

Checks if the order can be deleted (based on status)

canGenerateAgreement(){boolean}

Checks if a PDF document can be generated

canGoToReservation(){boolean}

Checks if the order has an reservation linked to it

canRemoveItems(){boolean}

Checks if items can be removed from the checkout (based on status)

canSwapItems(){boolean}

Checks if items can be swapped in the checkout (based on status)

canUndoCheckout(){boolean}

Checks if order can undo checkout

checkin(itemIds, location, skipRead, skipErrorHandling){promise}

Checks in the order

Name Type Description
itemIds
location
skipRead
skipErrorHandling

checkout(skipRead, skipErrorHandling){promise}

Checks out the order

Name Type Description
skipRead
skipErrorHandling

inherited clearContact(skipRead){promise}

Clears the contact for this transaction

Name Type Description
skipRead

skip parsing the returned json response into the transaction

inherited clearCover(skipRead){promise}

Clears the cover image

Name Type Description
skipRead

clearDueDate(skipRead){*}

Clears the order due date

Name Type Description
skipRead

inherited clearField(field, skipRead)

Clears a custom field

Name Type Description
field
skipRead

clearFromDate(skipRead){promise}

Clears the order from date

Name Type Description
skipRead

inherited 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

inherited clearLocation(skipRead){promise}

Clears the location for this transaction

Name Type Description
skipRead

skip parsing the returned json response into the transaction

inherited clearName(skipRead){promise}

Clears transaction name

Name Type Description
skipRead

skip parsing the returned json response into the transaction

inherited 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

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 order

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

getDuration(){duration}

Gets a moment duration object

getFriendlyDuration(){string}

Gets a friendly order duration or empty string

inherited getMaxDate(){Moment}

DEPRECATED Gets the latest possible date to end this transaction

Returns:
date

inherited getMaxDateDue(){Moment}

Gets the highest possible due date, by default same as getMaxDateDue

inherited getMaxDateFrom(){Moment}

Gets the highest possible from date, by default years from now

inherited getMaxDateTo(){Moment}

Gets the highest possible to date, by default years from now

inherited getMinDate(){Moment}

DEPRECATED Gets the lowest possible date to start this transaction

Returns:
date

inherited getMinDateDue(){Moment}

Gets the lowest possible due date, by default same as getMinDateTo

inherited getMinDateFrom(){Moment}

Gets the lowest possible from date, by default now

inherited getMinDateTo(){Moment}

Gets the lowest possible to date, by default from +1 timeslot

inherited hasItems(itemIds){Array}

hasItems; Gets a list of items that are already part of the transaction

Name Type Description
itemIds

array of string values

inherited isDirty(){boolean}

Checks if the transaction is dirty and needs saving

inherited 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

inherited 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

searchItems(params, useAvailabilies, onlyUnbooked, skipItems){promise}

Searches for items that could match this order

Name Type Description
params
useAvailabilies
onlyUnbooked
skipItems

inherited setContact(contactId, skipRead){promise}

Sets the contact for this transaction

Name Type Description
contactId
skipRead

skip parsing the returned json response into the transaction

inherited setCover(att, skipRead){promise}

Set the cover image to an Attachment

Name Type Description
att
skipRead

setDueDate(due, skipRead){promise}

Sets the order due date _checkFromDueDate will handle the special check for when the order is open

Name Type Description
due
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

setFromDate(date, skipRead){promise}

Sets the Order from date

Name Type Description
date
skipRead

setFromDueDate(from, due, skipRead){promise}

Sets the Order from and due date in a single call _checkFromDueDate will handle the special check for when the order is open

Name Type Description
from
due

(optional) if null, we'll take the default average checkout duration as due date

skipRead

inherited setLocation(locationId, skipRead){promise}

Sets the location for this transaction

Name Type Description
locationId
skipRead

skip parsing the returned json response into the transaction

inherited setName(name, skipRead){promise}

Sets transaction name

Name Type Description
name
skipRead

skip parsing the returned json response into the transaction

inherited setToDate(date, skipRead){promise}

Sets the transaction to date

Name Type Description
date
skipRead

inherited 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

inherited swapItem(fromItem, toItem, skipRead){promise}

swapItem; swaps one item for another in a transaction

Name Type Description
fromItem
toItem
skipRead

undoCheckout(skipRead){promise}

Undoes the order checkout

Name Type Description
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