numerus/web/template
jordi fita mas 183b8d3ed9 Allow importing contacts from Holded
This allows to import an Excel file exported from Holded, because it is
our own user case.  When we have more customers, we will give out an
Excel template file to fill out.

Why XLSX files instead of CSV, for instance? First, because this is the
output from Holded, but even then we would have more trouble with CSV
than with XLSX because of Microsoft: they royally fucked up
interoperability when decided that CSV files, the files that only other
applications or programmers see, should be “localized”, and use a comma
or a **semicolon** to separate a **comma** separated file depending on
the locale’s decimal separator.

This is ridiculous because it means that CSV files created with an Excel
in USA uses comma while the same Excel but with a French locale expects
the fields to be separated by semicolon.  And for no good reason,
either.

Since they fucked up so bad, decided to add a non-standard “meta” field
to specify the separator, writing a `sep=,` in the first line, but this
only works for reading, because saving the same file changes the
separator back to the locale-dependent character and removes the “meta”
field.

And since everyone expects to open spreadsheet with Excel, i can not
use CSV if i do not want a bunch of support tickets telling me that the
template is all in a single line.

I use an extremely old version of a xlsx reading library for golang[0]
because it is already available in Debian repositories, and the only
thing i want from it is to convert the convoluted XML file into a
string array.

Go is only responsible to read the file and dump its contents into a
temporary table, so that it can execute the PL/pgSQL function that will
actually move that data to the correct relations, much like add_contact
does but in batch.

In PostgreSQL version 16 they added a pg_input_is_valid function that
i would use to test whether input values really conform to domains,
but i will have to wait for Debian to pick up the new version.
Meanwhile, i use a couple of temporary functions, in lieu of nested
functions support in PostgreSQL.

Part of #45

[0]: https://github.com/tealeg/xlsx
2023-07-03 00:05:47 +02:00
..
contacts Allow importing contacts from Holded 2023-07-03 00:05:47 +02:00
expenses Add total amount for quotes, invoices, and expenses tables 2023-06-20 11:33:28 +02:00
invoices Add total amount for quotes, invoices, and expenses tables 2023-06-20 11:33:28 +02:00
products Use “Save” for all submit buttons of new/edit forms 2023-05-26 13:38:04 +02:00
quotes Split contact relation into tax_details, phone, web, and email 2023-06-30 21:32:48 +02:00
tags Add inline tag form for expenses 2023-05-08 12:58:54 +02:00
app.gohtml Change menu’s and profile icon 2023-07-02 19:49:03 +02:00
dashboard.gohtml Wrap filter buttons with <noscript> 2023-05-23 14:34:46 +02:00
form.gohtml Allow importing contacts from Holded 2023-07-03 00:05:47 +02:00
home.gohtml Internationalize and localize the home template 2023-06-16 10:58:40 +02:00
login.gohtml Use a “proper” struct for the login form 2023-02-01 11:02:32 +01:00
main.gohtml Add the <title> element for the “main” boosted pages 2023-03-26 13:57:24 +02:00
modal.gohtml Show the profile form in a dialog using HTMx 2023-03-20 13:09:52 +01:00
profile.gohtml Boost all breadcbrumb links 2023-04-02 16:10:13 +02:00
standalone.gohtml Allow editing invoice tags inline from the index table 2023-04-11 10:46:27 +02:00
tax-details.gohtml Add quote number formatting and next number field to tax details 2023-06-09 12:43:50 +02:00
web.gohtml Add custom function to get the current locale from templates 2023-01-31 15:45:51 +01:00