SilverCommerce\OrdersAdmin\Model\Invoice
Order objects track all the details of an order and if they were completed or not.
Makes use of permissions provider to lock out users who have not got the
relevent COMMERCE permissions for:
VIEW
EDIT
DELETE
You can define an order prefix by using the "order_prefix" config
variable
Any user can create an order (this allows us to support "guest" users).
Synopsis
class Invoice
extends Estimate
implements
PermissionProvider
{
- // members
- private static string $table_name = 'Invoice';
- private static integer $default_end = 0;
- private static array $statuses = ;
- private static array $outstanding_statuses = ;
- private static array $historic_statuses = ;
- private static array $paid_statuses = ;
- private static array $editable_statuses = ;
- private static string $default_status = "incomplete";
- private static string $pending_status = "pending";
- private static string $paid_status = "paid";
- private static string $part_paid_status = "part-paid";
- private static string $incomplete_status = "incomplete";
- private static string $processing_status = "processing";
- private static string $canceled_status = "canceled";
- private static string $refunded_status = "refunded";
- private static string $dispatched_status = "dispatched";
- private static string $collected_status = "collected";
- private static array $db = ;
- private static array $casting = ;
- private static array $summary_fields = ;
- private static array $export_fields = ;
- // methods
- public void populateDefaults()
- public string getTranslatedStatus()
- public string DisplayLink()
- public string PDFLink()
- public FieldList getCMSFields()
- public boolean isPaid()
- public Invoice markPaid()
- public Invoice markPartPaid()
- public Invoice markPending()
- public Invoice markProcessing()
- public Invoice markCanceled()
- public Invoice markRefunded()
- public Invoice markDispatched()
- public Invoice markCollected()
- protected string get_prefix()
- public void onBeforeWrite()
- public void onAfterWrite()
- public void providePermissions()
- public Boolean canView()
- public Boolean canCreate()
- public Boolean canEdit()
- public Boolean canChangeStatus()
- public Boolean canDelete()
- // Inherited methods from Estimate
- public string DisplayLink()
- public string PDFLink()
- public array getExportFields()
- public string getFullRef()
- public string getPersonalDetails()
- public string getBillingAddress()
- public string getCountryFull()
- public string getCountryUC()
- public string getDeliveryAddress()
- public string getDeliveryCountryFull()
- public string getDeliveryCountryUC()
- public int getTotalItems()
- public float getTotalWeight()
- public float getSubTotal()
- public float getTaxTotal()
- public ArrayList getTaxList()
- public float getTotal()
- public Invoice convertToInvoice()
- public string getItemSummary()
- public string getItemSummaryHTML()
- public boolean isDeliverable()
- public boolean isLocked()
- public FieldList getCMSFields()
- public void requireDefaultRecords()
- protected string get_prefix()
- protected int getBaseNumber()
- protected void generate_order_number()
- protected string generateOrderNumber()
- protected void generate_random_string()
- protected boolean validOrderNumber()
- protected boolean validAccessKey()
- public DataObject duplicate()
- public void onBeforeWrite()
- public void onAfterWrite()
- public void onBeforeDelete()
- public void providePermissions()
- public boolean canView()
- public boolean canCreate()
- public boolean canEdit()
- public boolean canDelete()
Hierarchy
Extends
Implements
- SilverStripe\Security\PermissionProvider
Members
private
- $canceled_status
—
string
The status which an order has been canceled. - $casting
- $collected_status
—
string
The status which an order has been marked collected (meaning goods collected from store). - $db
- $default_end
—
integer
The amount of days that by default that this estimate will end (cease to be valid). - $default_status
—
string
Set the default status for a new order, if this is set to null or blank, it will not be used. - $dispatched_status
—
string
The status which an order has been dispatched (sent to customer). - $editable_statuses
—
array
List of statuses that allow editing of an order. We can use this to fix certain orders in the CMS - $export_fields
—
array
Fields to use when exporting from `OrdersAdmin` - $historic_statuses
—
array
What statuses does an order need to be considered "historic" (meaning dispatched/completed, etc) - $incomplete_status
—
string
The status which an order has not been completed (meaning it is not ready for processing, dispatch, etc). - $outstanding_statuses
—
array
What statuses does an invoice need to be considered "outstanding" (meaning not dispatched or complete]). - $paid_status
—
string
The status which an order is considered "paid" (meaning ready for processing, dispatch, etc). - $paid_statuses
—
array
What statuses are considered "paid for". Meaning they are complete, ready for processing, etc. - $part_paid_status
—
string
The status which an order is considered "part paid" (meaning partially paid, possibly deposit paid). - $pending_status
—
string
The status which an order has been marked pending (meaning we are awaiting payment). - $processing_status
—
string
The status which an order is being processed - $refunded_status
—
string
The status which an order has been refunded. - $statuses
—
array
List of possible statuses this order can have. Rather than using an enum, we load this as a config variable that can be changed more freely. - $summary_fields
- $table_name
Methods
protected
- get_prefix() — Retrieve an order prefix from siteconfig for an Estimate
public
- DisplayLink() — Generate a link to view the associated front end display for this order
- PDFLink() — Generate a link to view the associated front end display for this order
- canChangeStatus() — Only users with EDIT admin rights can view an order
- canCreate() — Anyone can create orders, even guest users
- canDelete() — No one should be able to delete an order once it has been created
- canEdit() — Only users with EDIT admin rights can view an order
- canView() — Only order creators or users with VIEW admin rights can view
- getCMSFields() — Scaffold admin form feilds
- getTranslatedStatus() — Generate a translated variant of the current status
- isPaid() — Has this order been paid for? We determine this by checking one of the pre-defined "paid_statuses" in the config variable:
- markCanceled() — Mark this order as "canceled".
- markCollected() — Mark this order as "collected".
- markDispatched() — Mark this order as "dispatched".
- markPaid() — Mark this order as "paid"
- markPartPaid() — Mark this order as "part paid".
- markPending() — Mark this order as "pending" (awaiting payment to clear/reconcile).
- markProcessing() — Mark this order as "pending" (awaiting payment to clear/reconcile).
- markRefunded() — Mark this order as "refunded".
- onAfterWrite() — API Callback after this object is written to the DB
- onBeforeWrite() — API Callback after this object is written to the DB
- populateDefaults()
- providePermissions()
Inherited from SilverCommerce\OrdersAdmin\Model\Estimate
protected
- generateOrderNumber() — Generate an incremental estimate / invoice number.
- generate_order_number() — legacy method name - soon to be depreciated
- generate_random_string()
- getBaseNumber() — Get a base ID for the last Estimate in the DataBase
- get_prefix() — Retrieve an order prefix from siteconfig for an Estimate
- validAccessKey() — Check if the access key generated for this estimate is valid (exists on another object)
- validOrderNumber() — Check if the currently generated order number is valid (not duplicated)
public
- DisplayLink() — Generate a link to view the associated front end display for this order
- PDFLink() — Generate a link to view the associated front end display for this order
- canCreate() — Anyone can create orders, even guest users
- canDelete() — No one should be able to delete an order once it has been created
- canEdit() — Only users with EDIT admin rights can view an order
- canView() — Only order creators or users with VIEW admin rights can view
- convertToInvoice() — Factory method to convert this estimate to an order.
- duplicate() — Create a duplicate of this order/estimate as well as duplicating associated items
- getBillingAddress() — Get the complete billing address for this order
- getCMSFields() — Scaffold CMS form fields
- getCountryFull() — Get the rendered name of the billing country, based on the local
- getCountryUC() — Get the uppercase name of this country
- getDeliveryAddress() — Get the complete delivery address for this order
- getDeliveryCountryFull() — Get the rendered name of the delivery country, based on the local
- getDeliveryCountryUC() — Get the uppercase name of this country
- getExportFields() — Get the default export fields for this object
- getFullRef() — Get the full reference number for this estimate/invoice.
- getItemSummary() — Return a list string summarising each item in this order
- getItemSummaryHTML() — Return a list string summarising each item in this order
- getPersonalDetails() — Generate a string of the customer's personal details
- getSubTotal() — Total values of items in this order (without any tax)
- getTaxList() — Get a list of all taxes used and an associated value
- getTaxTotal() — Total values of items in this order
- getTotal() — Total value of order
- getTotalItems() — Find the total quantity of items in the shopping cart
- getTotalWeight() — Find the total weight of all items in the shopping cart
- isDeliverable() — Determine if the current estimate contains delivereable items.
- isLocked() — Determine if the current estimate contains only locked items.
- onAfterWrite() — API Callback after this object is written to the DB
- onBeforeDelete() — API Callback before this object is removed from to the DB
- onBeforeWrite()
- providePermissions()
- requireDefaultRecords()