Passed
Push — MODEL_LIB_240928 ( 143dd3...d1103d )
by Rafael
57:04 queued 21s
created

FactureRec::projet()   A

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
/* 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\Compta\Model;
20
21
use Carbon\Carbon;
22
use Dolibarr\Code\Projet\Model\Projet;
23
use Dolibarr\Code\Societe\Model\Societe;
24
use Dolibarr\Code\UserGroup\Model\User;
25
use Dolibarr\Core\Base\Model;
26
27
/**
28
 * Class FactureRec
29
 *
30
 * @property int $rowid
31
 * @property string $titre
32
 * @property int $entity
33
 * @property int|null $subtype
34
 * @property int $fk_soc
35
 * @property Carbon|null $datec
36
 * @property Carbon|null $tms
37
 * @property int|null $suspended
38
 * @property float $amount
39
 * @property float|null $remise
40
 * @property float|null $remise_percent
41
 * @property float|null $remise_absolue
42
 * @property string|null $vat_src_code
43
 * @property float|null $total_tva
44
 * @property float|null $localtax1
45
 * @property float|null $localtax2
46
 * @property float|null $revenuestamp
47
 * @property float|null $total_ht
48
 * @property float|null $total_ttc
49
 * @property int|null $fk_user_author
50
 * @property int|null $fk_user_modif
51
 * @property int|null $fk_projet
52
 * @property int $fk_cond_reglement
53
 * @property int|null $fk_mode_reglement
54
 * @property Carbon|null $date_lim_reglement
55
 * @property int|null $fk_account
56
 * @property string|null $note_private
57
 * @property string|null $note_public
58
 * @property string|null $modelpdf
59
 * @property int|null $fk_multicurrency
60
 * @property string|null $multicurrency_code
61
 * @property float|null $multicurrency_tx
62
 * @property float|null $multicurrency_total_ht
63
 * @property float|null $multicurrency_total_tva
64
 * @property float|null $multicurrency_total_ttc
65
 * @property int|null $usenewprice
66
 * @property int|null $frequency
67
 * @property string|null $unit_frequency
68
 * @property Carbon|null $date_when
69
 * @property Carbon|null $date_last_gen
70
 * @property int|null $nb_gen_done
71
 * @property int|null $nb_gen_max
72
 * @property int|null $auto_validate
73
 * @property int|null $generate_pdf
74
 *
75
 * @property Projet|null $projet
76
 * @property Societe $societe
77
 * @property User|null $user
78
 */
79
class FactureRec extends Model
80
{
81
    public $timestamps = false;
82
    protected $table = 'facture_rec';
83
    protected $casts = [
84
        'entity' => 'int',
85
        'subtype' => 'int',
86
        'fk_soc' => 'int',
87
        'datec' => 'datetime',
88
        'tms' => 'datetime',
89
        'suspended' => 'int',
90
        'amount' => 'float',
91
        'remise' => 'float',
92
        'remise_percent' => 'float',
93
        'remise_absolue' => 'float',
94
        'total_tva' => 'float',
95
        'localtax1' => 'float',
96
        'localtax2' => 'float',
97
        'revenuestamp' => 'float',
98
        'total_ht' => 'float',
99
        'total_ttc' => 'float',
100
        'fk_user_author' => 'int',
101
        'fk_user_modif' => 'int',
102
        'fk_projet' => 'int',
103
        'fk_cond_reglement' => 'int',
104
        'fk_mode_reglement' => 'int',
105
        'date_lim_reglement' => 'datetime',
106
        'fk_account' => 'int',
107
        'fk_multicurrency' => 'int',
108
        'multicurrency_tx' => 'float',
109
        'multicurrency_total_ht' => 'float',
110
        'multicurrency_total_tva' => 'float',
111
        'multicurrency_total_ttc' => 'float',
112
        'usenewprice' => 'int',
113
        'frequency' => 'int',
114
        'date_when' => 'datetime',
115
        'date_last_gen' => 'datetime',
116
        'nb_gen_done' => 'int',
117
        'nb_gen_max' => 'int',
118
        'auto_validate' => 'int',
119
        'generate_pdf' => 'int'
120
    ];
121
122
    protected $fillable = [
123
        'titre',
124
        'entity',
125
        'subtype',
126
        'fk_soc',
127
        'datec',
128
        'tms',
129
        'suspended',
130
        'amount',
131
        'remise',
132
        'remise_percent',
133
        'remise_absolue',
134
        'vat_src_code',
135
        'total_tva',
136
        'localtax1',
137
        'localtax2',
138
        'revenuestamp',
139
        'total_ht',
140
        'total_ttc',
141
        'fk_user_author',
142
        'fk_user_modif',
143
        'fk_projet',
144
        'fk_cond_reglement',
145
        'fk_mode_reglement',
146
        'date_lim_reglement',
147
        'fk_account',
148
        'note_private',
149
        'note_public',
150
        'modelpdf',
151
        'fk_multicurrency',
152
        'multicurrency_code',
153
        'multicurrency_tx',
154
        'multicurrency_total_ht',
155
        'multicurrency_total_tva',
156
        'multicurrency_total_ttc',
157
        'usenewprice',
158
        'frequency',
159
        'unit_frequency',
160
        'date_when',
161
        'date_last_gen',
162
        'nb_gen_done',
163
        'nb_gen_max',
164
        'auto_validate',
165
        'generate_pdf'
166
    ];
167
168
    public function projet()
169
    {
170
        return $this->belongsTo(Projet::class, 'fk_projet');
171
    }
172
173
    public function societe()
174
    {
175
        return $this->belongsTo(Societe::class, 'fk_soc');
176
    }
177
178
    public function user()
179
    {
180
        return $this->belongsTo(User::class, 'fk_user_author');
181
    }
182
}
183