Skip to content

Commit 55a3b3e

Browse files
authored
Merge pull request #16 from elguitarraverde/actualizar-a-fs2025
actualizar a fs2025
2 parents bff99a6 + 6bd6435 commit 55a3b3e

9 files changed

Lines changed: 44 additions & 43 deletions

Controller/EditRegularizacionImpuesto.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
class EditRegularizacionImpuesto extends EditController
4343
{
4444
/** @var float */
45-
public $purchases;
45+
public float $purchases;
4646

4747
/** @var float */
48-
public $sales;
48+
public float $sales;
4949

5050
/** @var float */
51-
public $total;
51+
public float $total;
5252

5353
/** @var array */
5454
public array $modelo303 = [];
@@ -63,7 +63,7 @@ public function getPageData(): array
6363
$data = parent::getPageData();
6464
$data['menu'] = 'reports';
6565
$data['title'] = 'model-303-390';
66-
$data['icon'] = 'fas fa-balance-scale-right';
66+
$data['icon'] = 'fa-solid fa-balance-scale-right';
6767
return $data;
6868
}
6969

@@ -97,7 +97,7 @@ protected function createAccountingEntryAction(): void
9797
{
9898
$reg = new RegularizacionImpuesto();
9999
$code = $this->request->get('code');
100-
if (false === $reg->loadFromCode($code)) {
100+
if (false === $reg->load($code)) {
101101
Tools::log()->warning('record-not-found');
102102
return;
103103
}
@@ -126,7 +126,7 @@ protected function createAccountingEntryAction(): void
126126
/**
127127
* Add the view set.
128128
*/
129-
protected function createViews()
129+
protected function createViews(): void
130130
{
131131
parent::createViews();
132132
$this->setTabsPosition('bottom');
@@ -137,7 +137,7 @@ protected function createViews()
137137

138138
protected function createViewsEntryLine(string $viewName = 'ListPartida'): void
139139
{
140-
$this->addListView($viewName, 'Partida', 'accounting-entry', 'fas fa-balance-scale');
140+
$this->addListView($viewName, 'Partida', 'accounting-entry', 'fa-solid fa-balance-scale');
141141
$this->disableButtons($viewName, true);
142142
}
143143

@@ -154,7 +154,7 @@ protected function createViewsTaxLine(string $viewName, string $caption, string
154154

155155
protected function createViewsTaxSummary(string $viewName = 'ListPartidaImpuestoResumen'): void
156156
{
157-
$this->addHtmlView($viewName, 'Modelo303', 'Impuesto', 'summary', 'fas fa-list-alt');
157+
$this->addHtmlView($viewName, 'Modelo303', 'Impuesto', 'summary', 'fa-solid fa-list-alt');
158158
$this->disableButtons($viewName);
159159
}
160160

@@ -173,7 +173,7 @@ protected function disableButtons(string $viewName, bool $clickable = false): vo
173173
*
174174
* @return bool
175175
*/
176-
protected function execPreviousAction($action)
176+
protected function execPreviousAction($action): bool
177177
{
178178
switch ($action) {
179179
case 'create-accounting-entry':
@@ -184,7 +184,7 @@ protected function execPreviousAction($action)
184184
return parent::execPreviousAction($action);
185185
}
186186

187-
protected function exportAction()
187+
protected function exportAction(): void
188188
{
189189
$this->exportManager->setOrientation('landscape');
190190
parent::exportAction();
@@ -227,7 +227,7 @@ protected function getListPartidaImpuestoResumen(BaseView $view): void
227227
new DataBaseWhere('codejercicio', $this->getModel()->codejercicio),
228228
new DataBaseWhere('fecha', $this->getModel()->fechainicio, '>='),
229229
new DataBaseWhere('fecha', $this->getModel()->fechafin, '<'),
230-
], [], 0, 0);
230+
]);
231231
$idsAsientos = array_unique(array_column($asientos, Asiento::primaryColumn()));
232232

233233
if(empty($idsAsientos)) {
@@ -238,7 +238,7 @@ protected function getListPartidaImpuestoResumen(BaseView $view): void
238238
$partidas = Partida::all([
239239
new DataBaseWhere('idasiento', $idsAsientos, 'IN'),
240240
new DataBaseWhere('codsubcuenta', $subcuentas, 'IN')
241-
], [], 0, 0);
241+
]);
242242

243243
// agrupamos por subcuenta
244244
$partidasAgrupadas = [];
@@ -390,7 +390,7 @@ protected function getPartidaImpuestoWhere(int $group): array
390390

391391
// obtenemos todos los ids de los asientos de las regularizaciones
392392
$ids = [];
393-
foreach (RegularizacionImpuesto::all([], [], 0, 0) as $reg) {
393+
foreach (RegularizacionImpuesto::all() as $reg) {
394394
if ($reg->idasiento) {
395395
$ids[] = $reg->idasiento;
396396
}
@@ -408,7 +408,7 @@ protected function getPartidaImpuestoWhere(int $group): array
408408
* @param string $viewName
409409
* @param BaseView $view
410410
*/
411-
protected function loadData($viewName, $view)
411+
protected function loadData($viewName, $view): void
412412
{
413413
switch ($viewName) {
414414
case 'EditRegularizacionImpuesto':
@@ -446,7 +446,7 @@ protected function setCreateAcEntryButton(string $viewName): void
446446
'action' => 'create-accounting-entry',
447447
'color' => 'success',
448448
'confirm' => true,
449-
'icon' => 'fas fa-balance-scale',
449+
'icon' => 'fa-solid fa-balance-scale',
450450
'label' => 'create-accounting-entry',
451451
'row' => 'actions'
452452
]);

Controller/ListRegularizacionImpuesto.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ public function getPageData(): array
3636
$data = parent::getPageData();
3737
$data['menu'] = 'reports';
3838
$data['title'] = 'model-303-390';
39-
$data['icon'] = 'fas fa-book';
39+
$data['icon'] = 'fa-solid fa-book';
4040
return $data;
4141
}
4242

4343
/**
4444
* Load views
4545
*/
46-
protected function createViews()
46+
protected function createViews(): void
4747
{
4848
$this->createViewsModel303();
4949
$this->createViewsModel390();
5050
}
5151

52-
protected function createViewsModel303(string $viewName = 'ListRegularizacionImpuesto')
52+
protected function createViewsModel303(string $viewName = 'ListRegularizacionImpuesto'): void
5353
{
54-
$this->addView($viewName, 'RegularizacionImpuesto', 'model-303', 'fas fa-book')
54+
$this->addView($viewName, 'RegularizacionImpuesto', 'model-303', 'fa-solid fa-book')
5555
->addOrderBy(['fechainicio'], 'start-date', 2)
5656
->addOrderBy(['codejercicio||periodo'], 'period')
5757
->addSearchFields(['codsubcuentaacr', 'codsubcuentadeu']);
@@ -67,9 +67,9 @@ protected function createViewsModel303(string $viewName = 'ListRegularizacionImp
6767
$this->addFilterSelect($viewName, 'codejercicio', 'exercise', 'codejercicio', $exercises);
6868
}
6969

70-
protected function createViewsModel390(string $viewName = 'ListRegularizacionImpuesto-390')
70+
protected function createViewsModel390(string $viewName = 'ListRegularizacionImpuesto-390'): void
7171
{
72-
$this->addView($viewName, 'RegularizacionImpuesto', 'model-390', 'fas fa-book')
72+
$this->addView($viewName, 'RegularizacionImpuesto', 'model-390', 'fa-solid fa-book')
7373
->addOrderBy(['fechainicio'], 'start-date', 2)
7474
->addOrderBy(['codejercicio||periodo'], 'period')
7575
->addSearchFields(['codsubcuentaacr', 'codsubcuentadeu']);

Lib/Accounting/VatRegularizationToAccounting.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
class VatRegularizationToAccounting
3939
{
4040
/** @var float */
41-
private $credit = 0.0;
41+
private float $credit = 0.0;
4242

4343
/** @var float */
44-
private $debit = 0.0;
44+
private float $debit = 0.0;
4545

4646
public function generate(RegularizacionImpuesto &$reg): bool
4747
{
@@ -64,10 +64,9 @@ public function generate(RegularizacionImpuesto &$reg): bool
6464
if ($this->addAccountingTaxLines($accEntry, $reg) &&
6565
$this->addAccountingResultLine($accEntry, $reg) &&
6666
$accEntry->isBalanced()) {
67-
6867
$accEntry->importe = max([$this->debit, $this->credit]);
6968
if ($accEntry->save()) {
70-
$reg->idasiento = $accEntry->primaryColumnValue();
69+
$reg->idasiento = $accEntry->id();
7170
$reg->fechaasiento = $accEntry->fecha;
7271
return true;
7372
}
@@ -84,7 +83,7 @@ protected function addAccountingResultLine(Asiento $accEntry, RegularizacionImpu
8483

8584
// si el debe es mayor que el haber, seleccionamos la cuenta de acreedores
8685
$id = $this->debit >= $this->credit ? $reg->idsubcuentaacr : $reg->idsubcuentadeu;
87-
if (false === $subaccount->loadFromCode($id)) {
86+
if (false === $subaccount->load($id)) {
8887
return false;
8988
}
9089

@@ -104,14 +103,14 @@ protected function addAccountingTaxLines(Asiento $accEntry, RegularizacionImpues
104103
{
105104
foreach ($this->getSubtotals($reg) as $idsubcuenta => $total) {
106105
$subaccount = new Subcuenta();
107-
if (false === $subaccount->loadFromCode($idsubcuenta)) {
106+
if (false === $subaccount->load($idsubcuenta)) {
108107
return false;
109108
}
110109

111110
$newLine = $accEntry->getNewLine();
112111
$newLine->setAccount($subaccount);
113-
$newLine->debe = round($total['debe'], FS_NF0);
114-
$newLine->haber = round($total['haber'], FS_NF0);
112+
$newLine->debe = round($total['debe'], Tools::settings('default', 'decimals'));
113+
$newLine->haber = round($total['haber'], Tools::settings('default', 'decimals'));
115114
if ($newLine->save()) {
116115
$this->debit += $newLine->debe;
117116
$this->credit += $newLine->haber;
@@ -176,9 +175,9 @@ private function checkInvoicesWithoutAccEntry($reg): bool
176175
new DataBaseWhere('idasiento', 'IS NULL')
177176
];
178177

179-
$facturasClienteSinAsiento = FacturaCliente::all($where, [], 0, 0);
178+
$facturasClienteSinAsiento = FacturaCliente::all($where);
180179

181-
$facturasProveedorSinAsiento = FacturaProveedor::all($where, [], 0, 0);
180+
$facturasProveedorSinAsiento = FacturaProveedor::all($where);
182181

183182
if (count($facturasClienteSinAsiento) > 0 || count($facturasProveedorSinAsiento) > 0) {
184183
return false;

Model/Join/PartidaImpuesto.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PartidaImpuesto extends JoinModel
4242
/**
4343
* Reset the values of all model view properties.
4444
*/
45-
public function clear()
45+
public function clear(): void
4646
{
4747
parent::clear();
4848
$this->baseimponible = 0.00;
@@ -57,12 +57,12 @@ protected function getFactura(): BusinessDocument
5757
$where = [new DataBaseWhere('idasiento', $this->idasiento ?? 0)];
5858

5959
$facturaCliente = new FacturaCliente();
60-
if ($facturaCliente->loadFromCode('', $where)) {
60+
if ($facturaCliente->loadWhere($where)) {
6161
return $facturaCliente;
6262
}
6363

6464
$facturaProveedor = new FacturaProveedor();
65-
$facturaProveedor->loadFromCode('', $where);
65+
$facturaProveedor->loadWhere($where);
6666
return $facturaProveedor;
6767
}
6868

@@ -123,7 +123,7 @@ protected function getTables(): array
123123
*
124124
* @param array $data
125125
*/
126-
protected function loadFromData(array $data)
126+
protected function loadFromData(array $data): void
127127
{
128128
parent::loadFromData($data);
129129

@@ -145,7 +145,7 @@ protected function loadFromData(array $data)
145145
// si el campo factura está vacío, buscamos la factura con este asiento
146146
if (empty($this->factura)) {
147147
$factura = $this->getFactura();
148-
if ($factura->primaryColumnValue()) {
148+
if ($factura->id()) {
149149
$this->factura = $factura->numero;
150150
$this->documento = $factura->codigo;
151151
$this->codserie = $factura->codserie;

Model/Join/PartidaImpuestoResumen.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class PartidaImpuestoResumen extends JoinModel
4545
/**
4646
* Reset the values of all model view properties.
4747
*/
48-
public function clear()
48+
public function clear(): void
4949
{
5050
parent::clear();
5151
$this->baseimponible = 0.0;
@@ -130,7 +130,7 @@ protected function getTables(): array
130130
*
131131
* @param array $data
132132
*/
133-
protected function loadFromData($data)
133+
protected function loadFromData(array $data): void
134134
{
135135
parent::loadFromData($data);
136136

Test/main/ComprobarFechaDevengoTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace FacturaScripts\Test\Plugins;
44

5+
use Exception;
56
use FacturaScripts\Core\Base\DataBase\DataBaseWhere;
67
use FacturaScripts\Core\Model\FacturaCliente;
78
use FacturaScripts\Core\Tools;
@@ -18,6 +19,7 @@ class ComprobarFechaDevengoTest extends Modelo303TestCase
1819
* y si no existe por la fecha de la factura.
1920
*
2021
* @return void
22+
* @throws Exception
2123
*/
2224
public function testComprobarFechaDevengo()
2325
{

Translation/updater.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$files[] = $lang . '.json';
1212
}
1313
foreach (scandir(__DIR__, SCANDIR_SORT_ASCENDING) as $filename) {
14-
if (is_file($filename) && substr($filename, -5) === '.json' && false === in_array($filename, $files)) {
14+
if (is_file($filename) && str_ends_with($filename, '.json') && false === in_array($filename, $files)) {
1515
$files[] = $filename;
1616
}
1717
}
@@ -39,4 +39,4 @@
3939
}
4040

4141
echo "Skip " . $filename . "\n";
42-
}
42+
}

XMLView/ListPartidaImpuestoResumen.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<rows>
6969
<row type="footer">
7070
<group name="actions"/>
71-
<group name="summary" html="Block/PartidaImpuestoResumen.html.twig"></group>
71+
<group name="summary" html="Block/PartidaImpuestoResumen.html.twig"/>
7272
</row>
7373
<row type="status">
7474
<option color="warning" fieldname="codcuentaesp">IVASOP</option>

facturascripts.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name = 'Modelo303'
22
description = 'Modelo 303 y 390 de la Hacienda española para la declaración trimestral y anual de IVA.'
3-
version = 2.62
4-
min_version = 2023.2
3+
version = 2.7
4+
min_version = 2025

0 commit comments

Comments
 (0)