Added 'preset on duplicate'

SVN revision: 1713
This commit is contained in:
2006-08-15 11:08:23 +00:00
parent 2a3ebf2706
commit 469d259ed4
2 changed files with 50 additions and 0 deletions
+6
View File
@@ -1066,6 +1066,12 @@ XYZ-2005-Nov-002
Same as <b><code>Preset &lt;attribute&gt;</code></b>, but evaluated for
replies.
</li>
<li>
<b><code>Preset on duplicate &lt;attribute&gt; =
&lt;string&gt;</code></b><br>
Same as <b><code>Preset &lt;attribute&gt;</code></b>, but evaluated for
duplicted entries.
</li>
<li>
<b><code>Locked Attributes = &lt;list&gt;</code></b><br>
The attributes specified here cannot be modified when a new entry is
+44
View File
@@ -8607,6 +8607,28 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
}
}
sprintf(str, "Preset on duplicate %s", attr_list[index]);
if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0 && bduplicate) {
if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib,
(attr_flags[index] & (AF_DATE | AF_DATETIME)) == 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
get_auto_index(lbs, index, preset, str, sizeof(str));
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
}
}
/* check for p<attribute> */
sprintf(str, "p%s", attr_list[index]);
if (isparam(str))
@@ -8670,6 +8692,28 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(attrib[index], preset);
}
}
sprintf(str, "Preset on duplicate %s", attr_list[index]);
if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0 && bduplicate) {
if (!breedit || (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */
i = build_subst_list(lbs, slist, svalue, attrib,
(attr_flags[index] & (AF_DATE | AF_DATETIME)) == 0);
strsubst_list(preset, sizeof(preset), slist, svalue, i);
/* check for index substitution */
if (!bedit && (strchr(preset, '%') || strchr(preset, '#'))) {
/* get index */
get_auto_index(lbs, index, preset, str, sizeof(str));
strcpy(preset, str);
}
if (!strchr(preset, '%'))
strcpy(attrib[index], preset);
}
}
}
} else // if (_condition[0])