Topic: update journal entry has query issue

Hello @joe,

This post is for the @joe and @apmuthu to update their repo.

gl/includes/db/gl_journal.inc

Here there is a function for update_journal

function update_journal($type, $trans_no, $amount, $tran_date, $currency, $reference, $source_ref='', $rate=1,
     $event_date='', $doc_date='')
{
    $sql = "UPDATE ".TB_PREF."journal SET "
      ."`amount`=".db_escape($amount).","
      ."`currency`=".db_escape($currency).","
      ."`rate`=".db_escape($rate).","
      ."`reference`=".db_escape($reference).","
      ."`source_ref`=".db_escape($source_ref).","
      ."`tran_date`="."'".date2sql($tran_date)."',"
      ."`event_date`="."'".date2sql($event_date)."',"
      ."`doc_date`="."'".date2sql($doc_date)."')  // here the '(' should be removed. 
       WHERE `type`=".db_escape($type)." AND " ."`trans_no`=".db_escape($trans_no);

    return db_query($sql, 'cannot update journal entry');
}
Subscription service based on FA
HRM CRM POS batch Themes

Re: update journal entry has query issue

@kvvaradha: Good catch.
Wonder how it slipped thru for so long.

@joe: can commit it by removing the last closing bracket in the doc_date line.

Post's attachments

gl_SQL_Fix.jpg 117.3 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: update journal entry has query issue

This has been committed. Strange that this passed the MySql server without warnings!

Thanks for catching this.

/Joe

Re: update journal entry has query issue

No one has caught this problem because this function update_journal() has never been used in any where.
Don't know whether to be happy or sad neutral

Phuong

Re: update journal entry has query issue

@notrinos.

You are right. This is the reason why no errors are reported from MySql.

This is a redundant function at the moment. This should be removed. Will discuss this with Janusz.

Joe

Re: update journal entry has query issue

This is a new file in FA 2.4.x. Looks like it was made to be linked into an Edit Journal button on journal entries listing.

Re: update journal entry has query issue

This is created to use in edit journal. But unfortunately it's not used , but I am using it for editing the journal vouchers.

Subscription service based on FA
HRM CRM POS batch Themes

Re: update journal entry has query issue

@kvvaradha: Provide your patch to include in the core. During such editing, does the reference number of the entry change?

Re: update journal entry has query issue

The function write_journal_entries() defined in gl/includes/db/gl_journal.inc is now used to edit journal entries by first voiding it and then adding the modified entry it as a new one.

In FA 2.3.x, the said function write_journal_entries() is defined in gl/includes/db/gl_db_trans.inc.

Post's attachments

EditJournal.jpg 129.3 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

10 (edited by kvvaradha 03/29/2018 01:41:02 pm)

Re: update journal entry has query issue

The journal voucher customization I did it for a company. There it used. It won't be applied to core feature

Subscription service based on FA
HRM CRM POS batch Themes