What changes with the document
A Spanish DNI carries two surnames and a support number, different from the DNI number: it is printed separately and identifies that specific copy of the document. A NIE or a TIE work the same way, with their own check letter.
A passport carries other fields. If the form asks everyone for a second surname and a support number, a French guest with a passport ends up at the front desk, which is exactly what you wanted to avoid.
That is why, in our product, what the form asks for comes from a table of rules per document type. First the form knows which document it is, then it asks for exactly its fields.
The check letter is verified
The DNI and the NIE carry a letter calculated from the number. If it matches, the number is written correctly; if it fails, the form catches it on the spot and the guest corrects it there and then.
A passport is checked another way, with the digits in its machine-readable zone. That is why we treat the two cases separately: each document with the check that belongs to it.
The fields come from a photo, and the photo is discarded
The strip of characters at the bottom of the document carries check digits. When we read the photo, we verify those digits one by one.
That has a consequence we care about a lot: the fields are filled in only when the digits match, and a bad reading costs one more photo.
The photo is read to extract the registration fields and is discarded. What remains are the fields, which are the ones you have to keep anyway.
The name is kept as the document gives it
The machine-readable zone always uses letters from A to Z, and the name has been transliterated by the State that issued the document, with the tables of the civil aviation organisation. So a photo always yields a version in the Latin alphabet, and it is exactly the version the registration wants.
Hence the rule: we always use the version the document itself carries. If a name is written in Cyrillic, the Latin spelling comes from the document.
Surnames with more than one part are kept whole, and an automatic check watches over it.
Nationality comes in one code and is asked in another
The document gives the nationality as a three-letter code. The table that converts it is generated from the official register, with the exceptions the machine-readable zone really uses. Each country comes from the register.
Identity cards from other countries
A French carte nationale or a German Personalausweis is registered as another identity document, with its number, just like a passport or a DNI.
Frequently asked questions
Which rule sets the Spanish guest registration form? Royal Decree 933/2021, and the fields it asks for depend on each guest's document.
Should every guest be asked for a second surname and a support number? Only guests whose document carries them: a Spanish DNI or NIE has them, and a passport has other fields.
Is the photo of the document kept? The photo is read to extract the register fields and then discarded. What remains are the fields, which the hotel has to keep anyway.
