HarvestExpense::getUserAssignment()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * SaaS Link plugin for Craft CMS 3.x
4
 *
5
 * @link      https://workingconcept.com
6
 * @copyright Copyright (c) 2018 Working Concept Inc.
7
 */
8
9
namespace workingconcept\saaslink\models\harvest;
10
11
use craft\base\Model;
12
13
/**
14
 * Harvest Expense Model
15
 * https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/
16
 *
17
 * Note that there are some write-only fields here, and undocumented ones that come with a standard model via GET.
18
 */
19
class HarvestExpense extends Model
20
{
21
    // Properties
22
    // =========================================================================
23
24
    /**
25
     * @var int Unique ID for the expense.
26
     */
27
    public $id;
28
29
    /**
30
     * @var object An object containing the expense’s client id, name, and currency.
31
     */
32
    private $_client;
33
34
    /**
35
     * @var object An object containing the expense’s project id, name, and code.
36
     */
37
    private $_project;
38
39
    /**
40
     * @var integer The ID of the project associated with this expense. (write only)
41
     */
42
    public $project_id;
43
44
    /**
45
     * @var object An object containing the expense’s expense category id, name, unit_price, and unit_name.
46
     */
47
    private $_expense_category;
48
49
    /**
50
     * @var integer The ID of the expense category this expense is being tracked against. (write only)
51
     */
52
    public $expense_category_id;
53
54
    /**
55
     * @var object An object containing the id and name of the user that recorded the expense.
56
     */
57
    private $_user;
58
59
    /**
60
     * @var object A user assignment object of the user that recorded the expense.
61
     */
62
    private $_user_assignment;
63
64
    /**
65
     * @var object An object containing the expense’s receipt URL and file name.
66
     */
67
    private $_receipt;
68
69
    /**
70
     * @var string A receipt file to attach to the expense. If including a receipt, you must submit a multipart/form-data request. (write only)
71
     */
72
    public $receipt;
73
74
    /**
75
     * @var object Once the expense has been invoiced, this field will include the associated invoice’s id and number.
76
     */
77
    private $_invoice;
78
79
    /**
80
     * @var string Textual notes used to describe the expense.
81
     */
82
    public $notes;
83
84
    /**
85
     * @var float The total amount of the expense.
86
     */
87
    public $total_cost;
88
89
    /**
90
     * @var int The quantity of units to use in calculating the total_cost of the expense.
91
     */
92
    public $units;
93
94
    /**
95
     * @var boolean Whether the expense is billable or not.
96
     */
97
    public $billable;
98
99
    /**
100
     * @var boolean Whether the expense has been approved or closed for some other reason.
101
     */
102
    public $is_closed;
103
104
    /**
105
     * @var boolean Whether the expense has been been invoiced, approved, or the project or person related to the expense is archived.
106
     */
107
    public $is_locked;
108
109
    /**
110
     * @var boolean Whether or not the expense has been marked as invoiced.
111
     */
112
    public $is_billed;
113
114
    /**
115
     * @var string An explanation of why the expense has been locked.
116
     */
117
    public $locked_reason;
118
119
    /**
120
     * @var boolean Whether an attached expense receipt should be deleted. Pass true to delete the expense receipt. (write only)
121
     */
122
    public $delete_receipt;
123
124
    /**
125
     * @var string Date the expense occurred.
126
     */
127
    public $spent_date;
128
129
    /**
130
     * @var string Date and time the expense was created.
131
     */
132
    public $created_at;
133
134
    /**
135
     * @var string Date and time the expense was last updated.
136
     */
137
    public $updated_at;
138
139
140
    // Public Methods
141
    // =========================================================================
142
143
    
144
    public function getClient()
145
    {
146
        return $this->_client;
147
    }
148
149
    public function setClient($client)
150
    {
151
        return $this->_client = $client;
152
    }
153
154
    public function getProject()
155
    {
156
        return $this->_project;
157
    }
158
159
    public function setProject($project)
160
    {
161
        return $this->_project = $project;
162
    }
163
164
    public function getExpenseCategory()
165
    {
166
        return $this->_expense_category;
167
    }
168
169
    public function setExpense_Category($expenseCategory)
170
    {
171
        return $this->_expense_category = $expenseCategory;
172
    }
173
174
    public function getUser()
175
    {
176
        return $this->_user;
177
    }
178
179
    public function setUser($user)
180
    {
181
        return $this->_user = $user;
182
    }
183
184
    public function getUserAssignment()
185
    {
186
        return $this->_user_assignment;
187
    }
188
189
    public function setUser_Assignment($userAssignment)
190
    {
191
        return $this->_user_assignment = $userAssignment;
192
    }
193
194
    public function getReceipt()
195
    {
196
        return $this->_receipt;
197
    }
198
199
    public function setReceipt($receipt)
200
    {
201
        return $this->_receipt = $receipt;
202
    }
203
204
    public function getInvoice()
205
    {
206
        return $this->_invoice;
207
    }
208
209
    public function setInvoice($invoice)
210
    {
211
        return $this->_invoice = $invoice;
212
    }
213
214
    public function rules()
215
    {
216
        return [
217
            [[
218
                'id', 
219
                'units', 
220
             ], 'number', 'integerOnly' => true],
221
            [['id'], 'required'],
222
            [[
223
                'total_cost', 
224
             ], 'number', 'integerOnly' => false],
225
            [[
226
                'notes', 
227
                'locked_reason', 
228
                'spent_date', 
229
                'created_at', 
230
                'updated_at', 
231
             ], 'string'],
232
            [[
233
                'billable', 
234
                'is_closed', 
235
                'is_locked', 
236
                'is_billed', 
237
             ], 'boolean'],
238
        ];
239
    }
240
241
}
242