Implemented "Preserve IDs"

SVN revision: 2205
This commit is contained in:
2009-06-05 09:26:37 +00:00
parent 53977b1d88
commit fdd337540f
2 changed files with 24 additions and 2 deletions
+11 -1
View File
@@ -753,7 +753,8 @@ Menu commands = List, New, Edit, Delete, Reply, Duplicate, Find, Config, Help
<b><code>Copy to = &lt;logbook list&gt;</code></b> and <b><code>Move to
= &lt;logbook list&gt;</code></b> it is possible to specify a list of
destination logbooks, separated by commata. This can make sense if only
certain logbooks make sense as destinations.
certain logbooks make sense as destinations. The flag <code><b>Preserve IDs</b></code>
can be used to keep the entry ID in the destination logbook.
</li>
<li>
<b><code>List Menu commands = &lt;list&gt;</code></b><br>
@@ -2540,6 +2541,15 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
checkbox. In logbooks where a script should only be ocasionally
executed, it could make sense to set this flag to <b>1</b>.
</li>
<li>
<b><code>Preserve IDs = 0|1</code></b><br>
When a logbook entry is copied or moved to another logbook, it obtains
a new entry ID in the destination logbook. This can cause problems
if the logbook entries reference each other with their IDs. To keep the
same ID in the destination logbook, this setting can be set to <b>1</b>.
If an entry with the same ID in the destination logbook exists already,
it gets overwritten. Default for this setting is <b>0</b>.
</li>
</ul>
<p>
<a name="themes" id="themes"></a>
+13 -1
View File
@@ -22552,6 +22552,7 @@ void copy_to(LOGBOOK * lbs, int src_id, char *dest_logbook, int move, int orig_i
attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], encoding[80], locked_by[256], *buffer,
list[MAX_N_ATTR][NAME_LENGTH];
LOGBOOK *lbs_dest;
BOOL bedit;
for (i = 0; lb_list[i].name[0]; i++)
if (strieq(lb_list[i].name, dest_logbook))
@@ -22653,6 +22654,17 @@ void copy_to(LOGBOOK * lbs, int src_id, char *dest_logbook, int move, int orig_i
strsubst(text, TEXT_SIZE, str, str2);
}
/* keep original message ID if requested */
message_id = 0;
bedit = FALSE;
if (getcfg(lbs->name, "Preserve IDs", str, sizeof(str)) && atoi(str) == 1) {
message_id = source_id;
/* test if entry exists already */
status = el_retrieve(lbs_dest, message_id, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL);
bedit = (status == EL_SUCCESS);
}
/* if called recursively (for threads), put in correct in_reply_to */
str[0] = 0;
if (orig_id)
@@ -22661,7 +22673,7 @@ void copy_to(LOGBOOK * lbs, int src_id, char *dest_logbook, int move, int orig_i
/* submit in destination logbook without links, submit all attributes from
the source logbook even if the destination has a differnt number of attributes */
message_id = el_submit(lbs_dest, 0, FALSE, date, attr_list, attrib, lbs->n_attr, text, str, "",
message_id = el_submit(lbs_dest, message_id, bedit, date, attr_list, attrib, lbs->n_attr, text, str, "",
encoding, attachment, TRUE, NULL);
if (message_id <= 0) {