gtt-project / redmine_gtt_print

Plugin to add printing (with maps) to GTT
GNU General Public License v3.0
1 stars 2 forks source link

Not compatible with "redmine_gtt" plugin "main" branch #13

Closed sanak closed 4 months ago

sanak commented 2 years ago

Problem When printing with redmine_gtt plugin's main branch, I encountered the following error.

mapfish-print_1  | org.locationtech.jts.util.AssertionFailedException: Expected 0 but encountered 38: 
mapfish-print_1  | Errors were detected when analysing the @Requires dependencies of '(spec.attributes.map|mapAttribute)': 
mapfish-print_1  |  * double[] center depends on [scale]
mapfish-print_1  |  at org.mapfish.print.output.Values.populateFromAttributes(Values.java:229)
mapfish-print_1  |  at org.mapfish.print.output.Values.<init>(Values.java:153)
mapfish-print_1  |  at org.mapfish.print.output.Values.<init>(Values.java:110)

To Reproduce Setup redmine_gtt_print settings with redmine_gtt plugin's main branch, then click [Print] button.

Expectation The error should not happen.

sanak commented 2 years ago

The cause is that redmine_gtt main branch doesn't expose App.getScale() and App.getBasemapUrl() compatible methods, so those values become empty when requesting print.
https://github.com/gtt-project/redmine_gtt_print/blob/1.2-stable/assets/javascripts/gtt_print.js#L20-L21

var _submit = function () {
  $('input[name="gtt_print_job[scale]"]').val(App.getScale());
  $('input[name="gtt_print_job[basemap_url]"]').val(App.getBasemapUrl());
}

Without changing redmine_gtt plugin's TypeScript interface, getting basemap url and default scale (for point) from redmine_gtt plugin setting may be possible as alternative.

sanak commented 4 months ago

This was solved in 1.1-stable branch via PR:#35, so I close this. (I will merge it to main branch, later.)