Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ehr/resources/reports/schemas/study/Pedigree/Pedigree.r
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,19 @@ if ((nrow(labkey.data) == 0) | (all(is.na(labkey.data$dam)) & all(is.na(labkey.d
png(filename="${imgout:png_pedigree}", width = plotWidth, height=plotHeight);
par(xpd=TRUE);

plot(ptemp, align=T, width=15, symbolsize=symSize, cex=cexSize, col=fixedPed$colors, mar=c(4.1,3.5,4.1,3.8))
# kinship2's QP-based alignment (align=TRUE) can fail with "constraints are inconsistent,
# no solution!" on deep/looped pedigrees. Fall back to the unaligned layout in that case so
# the report still renders rather than aborting.
tryCatch(
plot(ptemp, align=TRUE, width=15, symbolsize=symSize, cex=cexSize, col=fixedPed$colors, mar=c(4.1,3.5,4.1,3.8)),
error = function(e) {
# Only the QP alignment failure is recoverable by dropping alignment; re-raise anything else.
if (!grepl("constraints are inconsistent", conditionMessage(e), fixed = TRUE))
stop(e)
message("Pedigree alignment failed (", conditionMessage(e), "); retrying with align=FALSE.")
plot(ptemp, align=FALSE, width=15, symbolsize=symSize, cex=cexSize, col=fixedPed$colors, mar=c(4.1,3.5,4.1,3.8))
}
)
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.",
side = 1, font = 3, cex = 0.95)
leg.txt <- c("Male", "Female", "Deceased")
Expand Down
14 changes: 9 additions & 5 deletions ehr/resources/web/ehr/window/SaveTemplateWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,25 @@ Ext4.define('EHR.window.SaveTemplateWindow', {

var tn = this.down('#templateName').getValue();
var rows = [];
var noFieldsSelected = false;

this.down('#theForm').items.each(function(tab){
var radioGroup = tab.down('#recordSelector');
var selections = radioGroup.getValue()[radioGroup.down('[name]').name];

if (selections == 'none')
return;

var fields = tab.down('#fieldSelector').getValue().fields;

if (!fields.length)
if (!fields || !fields.length){
noFieldsSelected = true;
return;
}

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

if (selections == 'none')
return;

var store = Ext4.StoreMgr.get(tab.storeId);

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

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

Expand Down
Loading