PrintedSalesOrder::insert()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Picqer\Financials\Exact;
4
5
/**
6
 * Class PrintedSalesOrder.
7
 *
8
 * @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesOrderPrintedSalesOrders
9
 *
10
 * @property string $OrderId Primary key, Reference to OrderID of SalesOrder
11
 * @property int $Division Division code
12
 * @property string $Document Contains the id of the document that was created
13
 * @property string $DocumentCreationError Contains the error message if an error occurred during the creation of the document
14
 * @property string $DocumentCreationSuccess Contains information if a document was succesfully created
15
 * @property string $DocumentLayout Based on this layout a PDF is created and attached to an Exact Online document and an email
16
 * @property string $EmailCreationError Contains the error message if an error occurred during the creation of the email
17
 * @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.
18
 * @property string $EmailLayout Based on this layout the email text is produced
19
 * @property string $ExtraText Extra text that can be added to the printed document and email
20
 * @property bool $SendEmailToCustomer Set to True if an email containing the sales order should be sent to the customer
21
 * @property string $SenderEmailAddress Email address from which the email will be sent. If not specified, the company email address will be used.
22
 */
23
class PrintedSalesOrder extends Model
24
{
25
    use Query\Findable;
26
    use Persistance\Storable;
27
28
    protected $primaryKey = 'OrderId';
29
30
    protected $fillable = [
31
        'OrderId',
32
        'Division',
33
        'Document',
34
        'DocumentCreationError',
35
        'DocumentCreationSuccess',
36
        'DocumentLayout',
37
        'EmailCreationError',
38
        'EmailCreationSuccess',
39
        'EmailLayout',
40
        'ExtraText',
41
        'SendEmailToCustomer',
42
        'SenderEmailAddress',
43
    ];
44
45
    /**
46
     * @return $this
47
     */
48
    public function save()
49
    {
50
        $this->fill($this->insert());
51
52
        return $this;
53
    }
54
55
    public function insert()
56
    {
57
        return $this->connection()->post($this->url, $this->json(0, true));
58
    }
59
60
    protected $url = 'salesorder/PrintedSalesOrders';
61
}
62