Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Extension/Model/Cliente.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* This file is part of FacturaScripts
* Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace FacturaScripts\Plugins\Modelo347\Extension\Model;

use Closure;

/**
* Auxiliar class for special actions into the customer.
* - Set excluir347 initial value.
*
* @author Jose Antonio Cuello Principal <yopli2000@gmail.com>
*
* @property bool excluir347
*/
class Cliente
{
public function clear(): Closure
{
return function () {
$this->excluir347 = false;
};
}
}
48 changes: 48 additions & 0 deletions Extension/Model/FacturaCliente.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* This file is part of FacturaScripts
* Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace FacturaScripts\Plugins\Modelo347\Extension\Model;

use Closure;

/**
* Auxiliar class for special actions into the business document.
* - setSubject: Set Modelo347 attributes values from the subject of the document.
*
* @author Jose Antonio Cuello Principal <yopli2000@gmail.com>
*
* @property bool excluir347
*/
class FacturaCliente
{
public function clear(): Closure
{
return function () {
$this->excluir347 = false;
};
}

public function setSubject(): Closure
{
return function ($subject) {
if (property_exists($subject, 'excluir347')) {
$this->excluir347 = $subject->excluir347;
}
};
}
}
48 changes: 48 additions & 0 deletions Extension/Model/FacturaProveedor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* This file is part of FacturaScripts
* Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace FacturaScripts\Plugins\Modelo347\Extension\Model;

use Closure;

/**
* Auxiliar class for special actions into the business document.
* - setSubject: Set Modelo347 attributes values from the subject of the document.
*
* @author Jose Antonio Cuello Principal <yopli2000@gmail.com>
*
* @property bool excluir347
*/
class FacturaProveedor
{
public function clear(): Closure
{
return function () {
$this->excluir347 = false;
};
}

public function setSubject(): Closure
{
return function ($subject) {
if (property_exists($subject, 'excluir347')) {
$this->excluir347 = $subject->excluir347;
}
};
}
}
39 changes: 39 additions & 0 deletions Extension/Model/Proveedor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* This file is part of FacturaScripts
* Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace FacturaScripts\Plugins\Modelo347\Extension\Model;

use Closure;

/**
* Auxiliar class for special actions into the supplier.
* - Set excluir347 initial value.
*
* @author Jose Antonio Cuello Principal <yopli2000@gmail.com>
*
* @property bool excluir347
*/
class Proveedor
{
public function clear(): Closure
{
return function () {
$this->excluir347 = false;
};
}
}
32 changes: 32 additions & 0 deletions Extension/Table/clientes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of Modelo347 plugin for FacturaScripts
Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Document : clientes.xml
Author : Jose Antonio Cuello <yopli2000@gmail.com>

Description:
Add fields to basic structure of clientes table.
- excluir347: indicates if the document should be excluded from 347.
-->
<table>
<column>
<name>excluir347</name>
<type>boolean</type>
<default>false</default>
</column>
</table>
2 changes: 1 addition & 1 deletion Extension/Table/facturascli.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of Modelo347 plugin for FacturaScripts
Copyright (C) 2020-2023 Carlos Garcia Gomez <carlos@facturascripts.com>
Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/Table/facturasprov.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of Modelo347 plugin for FacturaScripts
Copyright (C) 2020-2023 Carlos Garcia Gomez <carlos@facturascripts.com>
Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
Expand Down
31 changes: 31 additions & 0 deletions Extension/Table/proveedores.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of Modelo347 plugin for FacturaScripts
Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Document : proveedores.xml
Author : Dainier Rojas Jimenez <danredjim@gmail.com>
Description:
Add fields to basic structure of proveedores table.
- excluir347: indicates if the document should be excluded from 347.
-->
<table>
<column>
<name>excluir347</name>
<type>boolean</type>
<default>false</default>
</column>
</table>
32 changes: 32 additions & 0 deletions Extension/XMLView/EditCliente.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of FacturaScripts
* Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Dainier Rojas Jiménez <danredjim.com>
-->
<view>
<columns>
<group name="comercial" title="commercial-terms" numcolumns="12">
<column name="exclude-347" order="205" numcolumns="2">
<widget type="select" fieldname="excluir347" translate="true" required="true">
<values title="no">0</values>
<values title="yes">1</values>
</widget>
</column>
</group>
</columns>
</view>
32 changes: 32 additions & 0 deletions Extension/XMLView/EditProveedor.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of FacturaScripts
* Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Dainier Rojas Jiménez <danredjim.com>
-->
<view>
<columns>
<group name="comercial" title="commercial-terms" numcolumns="12">
<column name="exclude-347" order="205" numcolumns="2">
<widget type="select" fieldname="excluir347" translate="true" required="true">
<values title="no">0</values>
<values title="yes">1</values>
</widget>
</column>
</group>
</columns>
</view>
6 changes: 5 additions & 1 deletion Init.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Modelo347 plugin for FacturaScripts
* Copyright (C) 2020-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2017-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down Expand Up @@ -35,6 +35,10 @@ final class Init extends InitClass
{
public function init(): void
{
$this->loadExtension(new Extension\Model\Cliente());
$this->loadExtension(new Extension\Model\FacturaCliente());
$this->loadExtension(new Extension\Model\FacturaProveedor());
$this->loadExtension(new Extension\Model\Proveedor());
PurchasesHeaderHTML::addMod(new Mod\PurchasesHeaderHTMLMod());
SalesHeaderHTML::addMod(new Mod\SalesHeaderHTMLMod());
}
Expand Down
2 changes: 1 addition & 1 deletion Mod/SalesHeaderHTMLMod.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function renderField(Translator $i18n, SalesDocument $model, string $fiel

private static function excluir347(Translator $i18n, SalesDocument $model): string
{
if (false === property_exists($model, 'excluir347') || empty($model->primaryColumnValue())) {
if (false === property_exists($model, 'excluir347')) {
return '';
}

Expand Down