Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New invoice types #5

Merged
merged 29 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
77e5746
Added full IBAN custom validation
RHarryH Jan 1, 2024
d4b1143
Adopted to the latest version of ECM
RHarryH Jan 10, 2024
0c0f472
Pagination in list widget
RHarryH Jan 11, 2024
ad1a8f8
Added filter to the select source pp
RHarryH Jan 20, 2024
c752134
Fixed expressions
RHarryH Jan 25, 2024
d4485a5
Updated configuration to use new combo/radio dictionary settings
RHarryH Jan 25, 2024
004cc05
Test fix
RHarryH Jan 26, 2024
d7a7369
Added extraction of nested and table properties in list widget
RHarryH Jan 31, 2024
190d0c3
New link document configuration allowing to link documents together
RHarryH Feb 4, 2024
ad36de1
Simplified link document config
RHarryH Feb 4, 2024
bd3c78a
BigDecimal utils
RHarryH Feb 8, 2024
d6ded98
When content of the document does not exist then directory node mappe…
RHarryH Feb 9, 2024
4af6d94
Custom labels for list widget
RHarryH Feb 10, 2024
3a012c7
Added initial CRUD configuration for correction invoices (no template…
RHarryH Feb 11, 2024
357e940
Format improvements
RHarryH Mar 1, 2024
7bc5acb
Generating of correction invoices
RHarryH Mar 7, 2024
3e18f45
Schema script fixes
RHarryH Mar 24, 2024
9468df6
Fixed Counter Strategies + added tests
RHarryH Mar 25, 2024
c396a09
Migration script
RHarryH Mar 26, 2024
24c9de9
Updated migration script from previous release
RHarryH Mar 29, 2024
5b535bb
Invoice templates fixes
RHarryH Mar 29, 2024
30c12aa
Paths fix
RHarryH Mar 29, 2024
7376d54
List widget configuration overwrite fix
RHarryH Mar 29, 2024
059103d
Defined env file in docker-compose.yml
RHarryH Apr 2, 2024
6763156
Use of new Avispa repository
RHarryH Apr 6, 2024
c38def1
Fixed Jacoco steps in build
RHarryH Apr 6, 2024
ab00f09
Workaround for Spring Boot bug
RHarryH Apr 7, 2024
2679b2b
Fixed badges generation, updated ECM version
RHarryH Apr 10, 2024
5ad686f
Documentation update, updated version to 2.2.0
RHarryH Apr 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 5 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ jobs:
distribution: 'temurin'
java-version: '17'

# because Avispa ECM is not available now in any public Maven repository
# it needs to be checked out and installed manually
- name: Checkout of Avispa ECM
uses: actions/[email protected]
with:
repository: RHarryH/avispa-ecm

- name: Installment of Avispa ECM into Maven repository
run: mvn -B -DskipTests install

# here the actual build starts
- name: Standard Checkout
uses: actions/[email protected]
Expand All @@ -31,36 +21,23 @@ jobs:
uses: actions/[email protected]
with:
name: jacoco-report
path: microf-custom/target/site/jacoco-aggregate/

generate_badges:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
needs: build_job
steps:
- name: Get JaCoCo coverage report
uses: actions/[email protected]
with:
name: jacoco-report
path: microf-custom/target/site/jacoco-aggregate/
path: aggregate-report/target/site/jacoco-aggregate/

- name: Generate JaCoCo Badge
if: github.ref == 'refs/heads/develop'
id: jacoco
uses: cicirello/[email protected]
with:
jacoco-csv-file: microf-custom/target/site/jacoco-aggregate/jacoco.csv
generate-branches-badge: true

- name: Log coverage percentage
if: github.ref == 'refs/heads/develop'
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"

- name: Shallow Checkout
uses: actions/[email protected]
with:
fetch-depth: 1

- name: Commit and push the badge (if it changed)
if: github.ref == 'refs/heads/develop'
uses: EndBug/[email protected]
with:
default_author: github_actions
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
target/
logs/
/config/
!/config/microf.docker.template.properties
docker/
!docker/.prod.template.env
!docker/docker-compose.yml
sql/06-avispa-*.sql
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
Expand Down
13 changes: 13 additions & 0 deletions .run/ECM Client Application.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ECM Client Application" type="SpringBootApplicationConfigurationType"
factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev"/>
<option name="ALTERNATIVE_JRE_PATH" value="temurin-17"/>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true"/>
<module name="ecm-client-backend"/>
<option name="SPRING_BOOT_MAIN_CLASS" value="com.avispa.ecm.EcmClientApplication"/>
<method v="2">
<option name="Make" enabled="true"/>
</method>
</configuration>
</component>
13 changes: 13 additions & 0 deletions .run/MicroF Application.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="MicroF Application" type="SpringBootApplicationConfigurationType"
factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev"/>
<module name="microf-custom"/>
<option name="SPRING_BOOT_MAIN_CLASS" value="com.avispa.ecm.EcmClientApplication"/>
<option name="VM_PARAMETERS" value="-Dspring.config.additional-location=file:config/microf.properties"/>
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/microf-custom"/>
<method v="2">
<option name="Make" enabled="true"/>
</method>
</configuration>
</component>
10 changes: 0 additions & 10 deletions .run/MicroFApplication.run.xml

This file was deleted.

119 changes: 86 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
![Status](https://github.com/RHarryH/avispa-microf/actions/workflows/main.yml/badge.svg) ![Coverage](.github/badges/jacoco.svg) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)

# Avispa μF
# Avispa ECM Client and Avispa μF

An invoice generating software built on top of Avispa ECM. It works with Polish invoices only
however can be recustomized for own needs.
Avispa ECM Client is a web application built on top of Avispa ECM. It allows to configure ECM for our own needs by
configuration and plugin-like customization.

Avispa μF is an invoice generating software. It works with Polish invoices only. It is a plugin for Avispa ECM Client
introducing new invoice types and their custom implementation allowing generation of pdf invoices thanks to Avispa ECM
rendition service, automated invoice number generation and many more.

Each release tries to further down separate the codebase of ECM Client and μF. Some features developed for μF are
migrated to the Client making it the "official" behaviour. Candidate for such migration might be templates variables.
ECM Client might be separated to the new project in the future.

## Running

To run locally pure ECM Client application by pointing `EcmClientApplication` as main class and
`ecm-client-backend` as classpath. For development purposes it is also possible to run ECM Client app with "installed"
μF by changing the classpath to `microf-custom` and adding
`-Dspring.config.additional-location=file:config/microf.properties` property.

`microf.properties` is not available in the project by default, however it is possible to use
`microf.docker.template.properties` as a base. Typically, this file can contain properties for initialization script
populating database with some initial records, issuer name, configuration location and overwrite file store paths.

Two environments are available:

- `dev` - can be run locally using IDE with `-Dspring.profiles.active=dev` property set.
Expand All @@ -28,8 +45,7 @@ Two environments are available:

In the final idea it should be the context responsibility to retrieve UI configurations. But because context operates
now only on objects, `configuration` properties were introduced. With contexts it would use groups definitions but it
requires
security implementation.
requires security implementation.

### ECM Client configuration

Expand All @@ -42,6 +58,9 @@ ECM Client provides an extension of ECM configuration zip file. It introduces fo
- `ecm_menu` for defining the menus visible on the navigation bar
- `ecm_list_widget` for defining what data type and which columns should be visible on the widget, this configuration is
later used in `ecm_layout`
- `ecm_link_document` extending document insertion capabilities by selecting first source document based on which the
new one will be created. Original document will be linked with the new one by the property specified in the
configuration.

### ECM Client names hierarchy

Expand All @@ -59,8 +78,8 @@ construct default basic application configuration.

### μF properties file

The application will search for `config/microf.properties` file. Below table presents the μF specific properties, which
can appear in the properties file.
As already mentioned, when running μF, the application will search for `config/microf.properties` file.
Below table presents the μF specific properties, which can appear in the properties file.

| Property name | Description |
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -70,28 +89,41 @@ can appear in the properties file.

### Docker

To build μF Docker image you can use following command:
Similarly to the local run, both ECM Client and μF can be run as separate applications. μF image is build on top of the
Client, and it mainly copies plugin dependencies to the ECM Client classpath so they will be automatically loaded at
ECM Client startup.

To build ECM Client Docker image you can use following command:

```shell
cd ecm-client-backend
docker build -t avispa/ecm-client-backend:latest -t avispa/ecm-client-backend:2.2.0 .
```

To build μF Docker image respectively you can use following command:

```shell
cd microf-custom
docker build -t avispa/microf:latest -t avispa/microf:2.1.0 .
docker build -t avispa/microf:latest -t avispa/microf:2.2.0 .
```

The application should be available on port `8080`.

However, it is more appropriate to use Docker Compose file, which will build Docker image and
start μF container alongside with PostgreSQL database. It is required to provide environment file.
start ECM Client/μF container alongside with PostgreSQL database. It is required to provide environment file.
Create it based on the `docker/.prod.template.env`.

Examples below use ECM Client as example but it is also applicable for μF just by changing the folder and image names.

```shell
cd docker
cd ecm-client-backend
docker compose --env-file=.prod.env up -d
```

To always rebuild μF image use below command. Ensure the related container does not exist.
To always rebuild ECM Client image use below command. Ensure the related container does not exist.

```shell
docker compose --env-file=.prod.env up -d --no-deps --build microf
docker compose --env-file=.prod.env up -d --no-deps --build ecm-client
```

To rebuild all images use below command
Expand All @@ -103,9 +135,10 @@ docker compose --env-file=.prod.env up -d --no-deps --build
#### Image details

Image contains built-in LibreOffice with only Liberation fonts family supported to minimize the
image's size. LibreOffice is required by `ecm` to perform conversion of documents to `pdf`.
image's size. LibreOffice is required by Avispa ECM to perform conversion of documents to `pdf`.

There is one build argument. `MICROF_DIR` specifies internal path of μF. It is set to `/opt/microf` by default.
There is one build argument. `CLIENT_DIR` specifies internal path of Avispa ECM. It is set to `/opt/ecm-client` by
default.

Additionally, there are several environment variables presented in the below table.

Expand All @@ -118,7 +151,7 @@ Additionally, there are several environment variables presented in the below tab
| `REMOTE_DEBUG` | `-` | 1 to enable remote debugging capabilities |
| `REMOTE_DEBUG_PORT` | `-` | Remote debug port, `5005` by default |

For more explanation about the ECM properties please check `README.md` of `ecm` project.
For more explanation about the ECM properties please check `README.md` of Avispa ECM project.

#### Compose details

Expand All @@ -135,21 +168,32 @@ Below table presents environment variables, which should be set up in `.prod.env

The default structure looks like below:

For ECM Client (`ecm-client-backend` module):

1. Projects root path is the `WORKSPACE_PATH`
2. Root `docker` folder is the root path for PostgreSQL data volume (`data`), logs volume (`logs`),
repository/file-store volume (`repository`) and initial setup SQL scripts (`sql`). It also contains template
for `.prod.env` file.
3. `docker-compose.yml` and `Dockerfile` are in the module root path. This is also the expected location
for `.prod.env`.

For μF (`microf-custom` module):

1. Projects root path is the `WORKSPACE_PATH`
2. `config` folder contains `microf.properties` properties file (see `microf.docker.template.properties`) and
`microf-configuration.zip` customization configuration (it is automatically packed and copied by `microf-custom`
module)
3. `docker` folder contains environment file and `docker-compose.yml`. It is also the root path for PostgreSQL data
volume (`data`),
logs volume (`logs`), repository/file-store volume (`repository`) and initial setup SQL scripts (`sql`).
module from `config-zip` folder)
3. Root `docker` folder is the root path for PostgreSQL data volume (`data`), logs volume (`logs`),
repository/file-store volume (`repository`) and initial setup SQL scripts (`sql`). It also contains template
for `.prod.env` file.
4. `docker-compose.yml` and `Dockerfile` are in the module root path. This is also the expected location
for `.prod.env`.

All SQL scripts required to correctly set up application should be gathered the `docker/sql` folder. To do that follow
below
instructions:
below instructions:

1. Copy sql scripts to `docker/sql` from `sql` folder in `ecm` project.
2. PostgreSQL scripts from `sql` folder (`microf` module) are automatically copied during build.
3. PostgreSQL scripts from `emc-application` and `microf-custom` modules are automatically copied during build.
1. Copy manually sql scripts to `docker/sql` from `sql` folder in Avispa ECM project.
2. PostgreSQL scripts from `emc-client-backend` and `microf-custom` modules are automatically copied during build.

### Actuators

Expand Down Expand Up @@ -216,7 +260,7 @@ When creating multiple validation types it is recommended to follow below instru
- Common validation type should just extend base validation type and include all details annotated with `@JsonUnwrapped`
annotation.

## Payments logic
## Avispa μF payments logic

1. Deadline is always required to provide no matter if paid amount is equal to gross value of whole invoice. This value
is calculated only on the backend side.
Expand All @@ -228,9 +272,7 @@ When creating multiple validation types it is recommended to follow below instru

### General

1. When a widget fails to load, reloading always reloads only properties-widget as it is hard-coded
2. Despite there is an option to set a property page size, it is ignored and modal always use extra-large size
3. Error handling in general requires rework
1. Despite there is an option to set a property page size, it is ignored and modal always use extra-large size

### Problems with DTOs

Expand All @@ -254,12 +296,23 @@ when working with DTOs in MicroF.
is invisible on the Property Page and wasn't sent to the server by frontend).
6. Overall additional work needed to introduce new object

## Migration guide
One of the possible solutions is to create dedicated tool allowing to configure and generate all skeleton classes for
the user.

## Avispa μF migration guide

### 2.0.0 → 2.1.0

1. Access PostgreSQL container console and connect to the db with `psql -U microf` command.
2. Run `/ecm-client-backend/sql/03-schema-ecm-client-postgresql.sql` script to add missing tables.
3. Run `/migration/2_0_0-2_1_0.sql` script to change the type of `id` columns for existing tables. This covers both ECM
2. Run `/migration/2_0_0-2_1_0.sql` script to change the type of `id` columns for existing tables. This covers both ECM
and μF tables.
3. Run `/ecm-client-backend/sql/03-schema-ecm-client-postgresql.sql` script to add missing tables.
4. Load `microf-configuration.zip` from Swagger without configuration override.

### 2.1.0 → 2.2.0

1. Access PostgreSQL container console and connect to the db with `psql -U microf` command.
2. Run `/migration/2_0_0-2_1_0.sql` script to apply all model changes. This covers both ECM
and μF tables.
4. Load `microf-configuration.zip` from Swagger without configuration override.
3. Open Swagger and run `/v1/configuration/clear` to remove current configuration.
4. Load `microf-configuration.zip` from Swagger without configuration override to load fresh configuration.
Loading
Loading