|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* Copyright (C) 2024 Rafael San José <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* This program is free software; you can redistribute it and/or modify |
|
6
|
|
|
* it under the terms of the GNU General Public License as published by |
|
7
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
8
|
|
|
* any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* This program is distributed in the hope that it will be useful, |
|
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13
|
|
|
* GNU General Public License for more details. |
|
14
|
|
|
* |
|
15
|
|
|
* You should have received a copy of the GNU General Public License |
|
16
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace Dolibarr\Code\Delivery\Model; |
|
20
|
|
|
|
|
21
|
|
|
use Carbon\Carbon; |
|
22
|
|
|
use Dolibarr\Code\Societe\Model\Societe; |
|
23
|
|
|
use Dolibarr\Code\UserGroup\Model\User; |
|
24
|
|
|
use Dolibarr\Core\Base\Model; |
|
25
|
|
|
use Illuminate\Database\Eloquent\Collection; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class Delivery |
|
29
|
|
|
* |
|
30
|
|
|
* @property int $rowid |
|
31
|
|
|
* @property Carbon|null $tms |
|
32
|
|
|
* @property string $ref |
|
33
|
|
|
* @property int $entity |
|
34
|
|
|
* @property int $fk_soc |
|
35
|
|
|
* @property string|null $ref_ext |
|
36
|
|
|
* @property string|null $ref_customer |
|
37
|
|
|
* @property Carbon|null $date_creation |
|
38
|
|
|
* @property int|null $fk_user_author |
|
39
|
|
|
* @property Carbon|null $date_valid |
|
40
|
|
|
* @property int|null $fk_user_valid |
|
41
|
|
|
* @property Carbon|null $date_delivery |
|
42
|
|
|
* @property int|null $fk_address |
|
43
|
|
|
* @property int|null $fk_statut |
|
44
|
|
|
* @property float|null $total_ht |
|
45
|
|
|
* @property string|null $note_private |
|
46
|
|
|
* @property string|null $note_public |
|
47
|
|
|
* @property string|null $model_pdf |
|
48
|
|
|
* @property string|null $last_main_doc |
|
49
|
|
|
* @property int|null $fk_incoterms |
|
50
|
|
|
* @property string|null $location_incoterms |
|
51
|
|
|
* @property string|null $import_key |
|
52
|
|
|
* @property string|null $extraparams |
|
53
|
|
|
* |
|
54
|
|
|
* @property Societe $societe |
|
55
|
|
|
* @property User|null $user |
|
56
|
|
|
* @property Collection|Deliverydet[] $deliverydets |
|
57
|
|
|
*/ |
|
58
|
|
|
class Delivery extends Model |
|
59
|
|
|
{ |
|
60
|
|
|
public $timestamps = false; |
|
61
|
|
|
protected $table = 'delivery'; |
|
62
|
|
|
protected $casts = [ |
|
63
|
|
|
'tms' => 'datetime', |
|
64
|
|
|
'entity' => 'int', |
|
65
|
|
|
'fk_soc' => 'int', |
|
66
|
|
|
'date_creation' => 'datetime', |
|
67
|
|
|
'fk_user_author' => 'int', |
|
68
|
|
|
'date_valid' => 'datetime', |
|
69
|
|
|
'fk_user_valid' => 'int', |
|
70
|
|
|
'date_delivery' => 'datetime', |
|
71
|
|
|
'fk_address' => 'int', |
|
72
|
|
|
'fk_statut' => 'int', |
|
73
|
|
|
'total_ht' => 'float', |
|
74
|
|
|
'fk_incoterms' => 'int' |
|
75
|
|
|
]; |
|
76
|
|
|
|
|
77
|
|
|
protected $fillable = [ |
|
78
|
|
|
'tms', |
|
79
|
|
|
'ref', |
|
80
|
|
|
'entity', |
|
81
|
|
|
'fk_soc', |
|
82
|
|
|
'ref_ext', |
|
83
|
|
|
'ref_customer', |
|
84
|
|
|
'date_creation', |
|
85
|
|
|
'fk_user_author', |
|
86
|
|
|
'date_valid', |
|
87
|
|
|
'fk_user_valid', |
|
88
|
|
|
'date_delivery', |
|
89
|
|
|
'fk_address', |
|
90
|
|
|
'fk_statut', |
|
91
|
|
|
'total_ht', |
|
92
|
|
|
'note_private', |
|
93
|
|
|
'note_public', |
|
94
|
|
|
'model_pdf', |
|
95
|
|
|
'last_main_doc', |
|
96
|
|
|
'fk_incoterms', |
|
97
|
|
|
'location_incoterms', |
|
98
|
|
|
'import_key', |
|
99
|
|
|
'extraparams' |
|
100
|
|
|
]; |
|
101
|
|
|
|
|
102
|
|
|
public function societe() |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->belongsTo(Societe::class, 'fk_soc'); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function user() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->belongsTo(User::class, 'fk_user_valid'); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function deliverydets() |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->hasMany(Deliverydet::class, 'fk_delivery'); |
|
115
|
|
|
} |
|
116
|
|
|
} |
|
117
|
|
|
|