Completed
Pull Request — master (#286)
by Danny
01:57
created

PrintedSalesOrder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 19
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A insert() 0 3 1
A save() 0 4 1
1
<?php
2
3
namespace Picqer\Financials\Exact;
4
5
/**
6
 * Class PrintedSalesOrder
7
 *
8
 * @package Picqer\Financials\Exact
9
 * @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=salesorderPrintedSalesOrders
10
 *
11
 * @property Guid $OrderId Primary key, Reference to OrderId of SalesOrder
12
 * @property Int32 $Division Division code
13
 * @property Guid $Document Contains the id of the document that was created
14
 * @property String $DocumentCreationError Contains the error message if an error occurred during the creation of the document
15
 * @property String $DocumentCreationSuccess Contains information if a document was succesfully created
16
 * @property Guid $DocumentLayout Based on this layout a PDF is created and attached to an Exact Online document and an email
17
 * @property String $EmailCreationError Contains the error message if an error occurred during the creation of the email
18
 * @property String $EmailCreationSuccess Contains confirmation that an email was sent. If an email cannot be delivered this property will still show confirmation that the email was sent.
19
 * @property Guid $EmailLayout Based on this layout the email text is produced
20
 * @property String $ExtraText Extra text that can be added to the printed document and email
21
 * @property Boolean $SendEmailToCustomer Set to True if an email containing the invoice should be sent to the invoice customer
22
 * @property String $SenderEmailAddress Email address from which the email will be sent. If not specified, the company email address will be used.
23
 */
24
class PrintedSalesOrder extends Model
25
{
26
    protected $primaryKey = 'OrderId';
27
28
    protected $fillable = [
29
        'OrderId',
30
        'Division',
31
        'Document',
32
        'DocumentCreationError',
33
        'DocumentCreationSuccess',
34
        'DocumentLayout',
35
        'EmailCreationError',
36
        'EmailCreationSuccess',
37
        'EmailLayout',
38
        'ExtraText',
39
        'SendEmailToCustomer',
40
        'SenderEmailAddress'
41
    ];
42
43
    /**
44
     * @return $this
45
     */
46
    public function save()
47
    {
48
        $this->fill($this->insert());
49
        return $this;
50
    }
51
52
    public function insert()
53
    {
54
        return $this->connection()->post($this->url, $this->json(0, true));
55
    }
56
57
    protected $url = 'salesorder/PrintedSalesOrders';
58
}