fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
419 stars 290 forks source link

Report additions #4945

Open sevtor opened 5 months ago

sevtor commented 5 months ago

The app/Report tool creates reports from the collected gedcom data. The current version has some limitation and shortcomings that this update addresses. A detailed description is included as a pdf file, and in short the changes are:

Report tries to place text on an exact position on a page. But many pitfalls on the way. Counting lines in a textbox is not enough, the lines may be set in different font sizes; converting lines to points in HTML uses a much too high number, which results in a lot of white space, especially for long reports (many pages). The PDF reports have problems to predict when the tool TcPdf will break a line or add a page. This applies to the files HtmlRenderer.php, ReportHtmlTextbox.php, ReportHtmlText.php, PdfRenderer.php, ReportPdfTextBox.php and ReportPdfText.php,

The file ReportParserGenerate.php is responsible for the interpretation of the xml code that defines the layout and contents of the report. A number of addition have been introduced. (1) GetPersonName has got a new attribute, select=..., that allows the report to present the last name used or a combination of latest and surname at birth. Another attribute, fam_relation="1", will add the relation the current person to the start person of a report, e.g. mmf which means mother's mother's father. (2) The value that is returned by GedcomValue can be a very long string. An attribute truncate=... already exists but has been two new possibilities for dates: "Y" will give only the year and "d" gives the date with the three character short for the month, "dd mmm yyyy". (3) The calculation of the family relation that can be give with the name requires a substantial amount of code. (4) The xml keyword Facts returns all facts and events of the current object (person, family) in the order they appear. But in a report one wants chronological order and that has been implemented. A special addition is that a temporary gedcom event is introduced in the process, _SP_DEAT, which when a spouse has died, if applicable. This is used only during calculations, not added to the Gedcom database or file. This (hidden) gedcom value must be added to the gedcom.php file. (A similar presentation is given on the main page for each person.) (5) The keyword SetVar has been expanded with new possibilities for the attribute value=.... The value can now specify "@$xxx" which means the the value of xxx is interpreted as the name of the varible to select. Other new values are "@format" that responds PDF or HTML depending on whichever form of report is selected. "@$dump" can give some help in debugging new or modified reports. (6) Sometimes ancestors have married a relative. In pedigree charts these persons were given as separate persons, although with tha same name, birthdate, et c. But now such persons are detected and the second occurrance is given as "same person as ...". (7) Some errors are corrected.

sevtor commented 5 months ago

Unfortunately I used my own indentation rules and did not know how to fix it. So please make the corrections! And please tell me how I can use the tool StyleCI in the future.

codecov[bot] commented 5 months ago

Codecov Report

Attention: 130 lines in your changes are missing coverage. Please review.

Comparison is base (d5c9d9c) 32.29% compared to head (42b74bb) 32.53%. Report is 24 commits behind head on main.

Files Patch % Lines
app/Report/ReportParserGenerate.php 59.52% 119 Missing :warning:
app/Report/ReportHtmlTextbox.php 88.23% 4 Missing :warning:
app/Report/ReportPdfTextBox.php 85.18% 4 Missing :warning:
app/Gedcom.php 0.00% 2 Missing :warning:
app/Report/PdfRenderer.php 66.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4945 +/- ## ============================================ + Coverage 32.29% 32.53% +0.24% - Complexity 11401 11535 +134 ============================================ Files 1171 1172 +1 Lines 48056 48166 +110 ============================================ + Hits 15521 15673 +152 + Misses 32535 32493 -42 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sevtor commented 5 months ago

The static analysis checks that still fail relate to code that "always" has been there.

Therefore I want this pull request to be set to 'Ready for review' !

sevtor commented 5 months ago

PR ready for review!

sevtor commented 5 months ago

This PR solved the 'Missing data' Feature Request. It also handles translations for custom modules, especially reports, where the title and description strings were un-translated (because the translations were included too late).