mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Implemented "Preserve IDs"
SVN revision: 2205
This commit is contained in:
parent
53977b1d88
commit
fdd337540f
@ -753,7 +753,8 @@ Menu commands = List, New, Edit, Delete, Reply, Duplicate, Find, Config, Help
|
|||||||
<b><code>Copy to = <logbook list></code></b> and <b><code>Move to
|
<b><code>Copy to = <logbook list></code></b> and <b><code>Move to
|
||||||
= <logbook list></code></b> it is possible to specify a list of
|
= <logbook list></code></b> it is possible to specify a list of
|
||||||
destination logbooks, separated by commata. This can make sense if only
|
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>
|
||||||
<li>
|
<li>
|
||||||
<b><code>List Menu commands = <list></code></b><br>
|
<b><code>List Menu commands = <list></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
|
checkbox. In logbooks where a script should only be ocasionally
|
||||||
executed, it could make sense to set this flag to <b>1</b>.
|
executed, it could make sense to set this flag to <b>1</b>.
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<a name="themes" id="themes"></a>
|
<a name="themes" id="themes"></a>
|
||||||
|
|||||||
14
src/elogd.c
14
src/elogd.c
@ -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,
|
attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], encoding[80], locked_by[256], *buffer,
|
||||||
list[MAX_N_ATTR][NAME_LENGTH];
|
list[MAX_N_ATTR][NAME_LENGTH];
|
||||||
LOGBOOK *lbs_dest;
|
LOGBOOK *lbs_dest;
|
||||||
|
BOOL bedit;
|
||||||
|
|
||||||
for (i = 0; lb_list[i].name[0]; i++)
|
for (i = 0; lb_list[i].name[0]; i++)
|
||||||
if (strieq(lb_list[i].name, dest_logbook))
|
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);
|
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 */
|
/* if called recursively (for threads), put in correct in_reply_to */
|
||||||
str[0] = 0;
|
str[0] = 0;
|
||||||
if (orig_id)
|
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
|
/* submit in destination logbook without links, submit all attributes from
|
||||||
the source logbook even if the destination has a differnt number of attributes */
|
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);
|
encoding, attachment, TRUE, NULL);
|
||||||
|
|
||||||
if (message_id <= 0) {
|
if (message_id <= 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user