X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Freferences.inc;h=b67267c5ca41baad6c04e6aaa2e43a863c142865;hb=e735f0a06f8a43ed4885ff51a5c0b4332c130b40;hp=0c11ebee3defacaa1d96bcdfb61a25a862f08160;hpb=d2df4626a3e0087223538f0f572e47f18e9bcb95;p=fa-stable.git diff --git a/includes/references.inc b/includes/references.inc index 0c11ebee..b67267c5 100644 --- a/includes/references.inc +++ b/includes/references.inc @@ -101,8 +101,10 @@ class references } //---------------------------------------------------------------------------- - -function is_new_reference($ref, $type) +// +// Check if reference was not used so far (for other transaction than $trans_no) +// +function is_new_reference($ref, $type, $trans_no=0) { $db_info = get_systype_db_info($type); $db_name = $db_info[0]; @@ -133,6 +135,10 @@ function is_new_reference($ref, $type) WHERE $db_ref=$ref AND ISNULL(v.id)"; } + if ($trans_no) + { + $sql .= " AND $db_name.$db_trans != ".db_escape($trans_no); + } $result = db_query($sql, "could not test for unique reference"); return (db_num_rows($result) == 0);