X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Freferences.inc;h=bba6f155545d3c8ce773d3b8c35abb930d93b732;hb=11109ad9f0e6af3f59d72731a95e473e72fb308b;hp=0c11ebee3defacaa1d96bcdfb61a25a862f08160;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/includes/references.inc b/includes/references.inc index 0c11ebee..bba6f155 100644 --- a/includes/references.inc +++ b/includes/references.inc @@ -57,7 +57,7 @@ class references function save($type, $id, $reference) { update_reference($type, $id, $reference); // store in refs table - if ($reference == $this->get_next($type)) { // if reference was not changed from default + if ($reference == $this->get_next($type)) { // if reference was bigger or not changed from default $next = $this->_increment($reference); // increment default save_next_reference($type, $next); } @@ -100,44 +100,3 @@ class references } } -//---------------------------------------------------------------------------- - -function is_new_reference($ref, $type) -{ - $db_info = get_systype_db_info($type); - $db_name = $db_info[0]; - $db_type = $db_info[1]; - $db_trans = $db_info[2]; - $db_ref = $db_info[3]; - - $ref = db_escape(trim($ref)); - $type = db_escape($type); - - if ($db_ref == null) { // journal or bank trans store references in refs table - $db_ref = TB_PREF."refs"; - $db_type = 'type'; - $db_trans = 'id'; - $rb_ref = 'reference'; - } - - if ($db_type != null) { - $sql = "SELECT $db_ref FROM $db_name - LEFT JOIN ".TB_PREF."voided v ON - $db_name.$db_type=v.type AND $db_name.$db_trans=v.id - WHERE $db_name.$db_ref=$ref AND ISNULL(v.id) - AND $db_name.$db_type=$type"; - } else { - $sql = "SELECT $db_ref FROM $db_name - LEFT JOIN ".TB_PREF."voided v ON - v.type=$type AND $db_name.$db_trans=v.id - WHERE $db_ref=$ref AND ISNULL(v.id)"; - } - - $result = db_query($sql, "could not test for unique reference"); - - return (db_num_rows($result) == 0); - -} - - -?> \ No newline at end of file