| 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\Accountancy\Model; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use Dolibarr\Core\Base\Model; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use Illuminate\Database\Eloquent\Collection; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * Class AccountingSystem | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  * TODO: Possibly not being used | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  * @property int $rowid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * @property int|null $fk_country | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  * @property string $pcg_version | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  * @property string $label | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  * @property int|null $active | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  * @property Collection|AccountingAccount[] $accounting_accounts | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  * @package Dolibarr\Code\Compta\Model | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 38 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  | class AccountingSystem extends Model | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |     public $timestamps = false; | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |     protected $table = 'accounting_system'; | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |     protected $casts = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |         'fk_country' => 'int', | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |         'active' => 'int' | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |     ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |     protected $fillable = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |         'fk_country', | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |         'pcg_version', | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |         'label', | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |         'active' | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |     ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     public function accountingAccounts() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 59 |  |  |         return $this->hasMany(AccountingAccount::class, 'fk_pcg_version', 'pcg_version'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 61 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 62 |  |  |  |