Skip to content

Commit e69b68a

Browse files
Merge 26.6 to develop
2 parents c26c9a4 + 4db6003 commit e69b68a

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

ehr/resources/reports/schemas/study/Pedigree/Pedigree.r

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,19 @@ if ((nrow(labkey.data) == 0) | (all(is.na(labkey.data$dam)) & all(is.na(labkey.d
300300
png(filename="${imgout:png_pedigree}", width = plotWidth, height=plotHeight);
301301
par(xpd=TRUE);
302302

303-
plot(ptemp, align=T, width=15, symbolsize=symSize, cex=cexSize, col=fixedPed$colors, mar=c(4.1,3.5,4.1,3.8))
303+
# kinship2's QP-based alignment (align=TRUE) can fail with "constraints are inconsistent,
304+
# no solution!" on deep/looped pedigrees. Fall back to the unaligned layout in that case so
305+
# the report still renders rather than aborting.
306+
tryCatch(
307+
plot(ptemp, align=TRUE, width=15, symbolsize=symSize, cex=cexSize, col=fixedPed$colors, mar=c(4.1,3.5,4.1,3.8)),
308+
error = function(e) {
309+
# Only the QP alignment failure is recoverable by dropping alignment; re-raise anything else.
310+
if (!grepl("constraints are inconsistent", conditionMessage(e), fixed = TRUE))
311+
stop(e)
312+
message("Pedigree alignment failed (", conditionMessage(e), "); retrying with align=FALSE.")
313+
plot(ptemp, align=FALSE, width=15, symbolsize=symSize, cex=cexSize, col=fixedPed$colors, mar=c(4.1,3.5,4.1,3.8))
314+
}
315+
)
304316
mtext("Unknown animals are marked with xxs ## or xxd ## where ## is a randomly generated unique number. This identifier is used only in this plot and is re-generated each time the plot is rendered.",
305317
side = 1, font = 3, cex = 0.95)
306318
leg.txt <- c("Male", "Female", "Deceased")

ehr/resources/web/ehr/window/SaveTemplateWindow.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,25 @@ Ext4.define('EHR.window.SaveTemplateWindow', {
202202

203203
var tn = this.down('#templateName').getValue();
204204
var rows = [];
205+
var noFieldsSelected = false;
205206

206207
this.down('#theForm').items.each(function(tab){
207208
var radioGroup = tab.down('#recordSelector');
208209
var selections = radioGroup.getValue()[radioGroup.down('[name]').name];
210+
211+
if (selections == 'none')
212+
return;
213+
209214
var fields = tab.down('#fieldSelector').getValue().fields;
210215

211-
if (!fields.length)
216+
if (!fields || !fields.length){
217+
noFieldsSelected = true;
212218
return;
219+
}
213220

214221
if (!(fields instanceof Array)) // single elements aren't wrapped in an array
215222
fields = [fields];
216223

217-
if (selections == 'none')
218-
return;
219-
220224
var store = Ext4.StoreMgr.get(tab.storeId);
221225

222226
var records = [];
@@ -249,7 +253,7 @@ Ext4.define('EHR.window.SaveTemplateWindow', {
249253

250254
if (!rows.length){
251255
Ext4.Msg.hide();
252-
Ext4.Msg.alert('Error', "No records selected");
256+
Ext4.Msg.alert('Error', noFieldsSelected ? "At least one field is required and none are selected. Note: The field can be blank." : "No records selected");
253257
return;
254258
}
255259

0 commit comments

Comments
 (0)