FA 2.4.1 - If you create a journal entry, attach a document, and then later edit the journal entry (e.g. journal enquiry - edit), the old journal number is voided, and a new journal number created.  However, the attachment data is NOT updated, so the document is orphaned, and the journal no longer is associated to the document, so doesn't list it for viewing.

The FIX:  (in gl/gl_journal.php)
Line 298:
if (isset($_POST['Process']))
{
        $cart = &$_SESSION['journal_items'];
        $new = $cart->order_id == 0;
                /***************
                * Start of fix for orphaned attachments
                ***************/
        $old_trans_type = $cart->trans_type;
        $old_trans_no = $cart->order_id;
                /***************/

new line 342:
        unset($_SESSION['journal_items']);
                /*********************************************
                * original code does not update attachments.
                * The old trans no is zero'd/marked voided and a new trans created
                * This leads to an orphaned transaction. 
                *
                * Update attachment info
                ***********************************************/
        if( isset( $old_trans_no ) )
        {
                $sql = "UPDATE " . TB_PREF . "attachments SET `trans_no` = '" . $trans_no . "' WHERE trans_no = '" . $old_trans_no . "' and type_no = '" . $old_trans_type . "'";
                db_query( $sql, "Couldn't update attachments" );
        }
                /***************/

I have not checked the other functions (i.e. bank payments/deposits, etc) but expect they are similar.  I did see void_transaction function then calls different void_XXX_trans functions so didn't chase down the rabbit hole.  If they all call the db HOOKs calls this could be made into a module but I didn't chase that neither.

2

(10 replies, posted in Wish List)

geesyscare wrote:
fraserks wrote:

I am working on a multi-way sync between FA, SuiteCRM, WooCommerce, SquareUp.

SuiteCRM and vTiger share some history.

I have a module for pushing Inventory items to WooCommerce working (for "simple" items i.e. not variations).  I have it also roughed up to send to SuiteCRM.

SuiteCRM has a workflow engine that can trigger on records being saved; I have experimental code for sending Accounts and Contacts data to the API in FA.

My intent is to release these once further testing and code cleanup has occurred.  However at the moment I am working on bookkeeping audits and cleanups so there may be some delay sad

Can you please share your code here?

I am just finishing up our tax returns for this year.  I will then work on uploading but won't be for another few weeks...

I would like to suggest a function similar to the Revenue/Cost Accrual screen in that a Mortgage payment or Auto Loan could be set up. 

While I could take the entire loan (principal + cost i.e. interest) and divide over the period, the reality is that you pay more interest at the start of the loan and less principal, and as time goes on there is a small shift from payment to payment as to the amount that is principal and that which is interest.

If I hold the loan for its entire duration (i.e. I pay off the car) then the averaged interest (para above) is a wash, but if I sell the asset and must pay off the outstanding principal, the interest calculations will therefore be off.  This also can have tax implications if the interest is deductible (business use is, here).

To adopt the Cost Accrual method, we would need 3 accounts instead of 2 - Outstanding Principal, Principal Payment Accrual Account, and Interest Paid accrual account.  We would then also need the Interest and the Principal Payment amounts to be calculated using the amortization formula instead of simply dividing the accrual amount by the number of periods.

I'll be adding this to my personal TODO programming list, but it will be a medium to low priority for my projects list, so if someone else has time to take a swing at this...

4

(3 replies, posted in Wish List)

If this hasn't been added to the Core yet, I have a rudimentary module for recording dimensions and weight against inventory items.  It's buggy, and it was aimed at providing these fields for a "push to WooCommerce" module so is not integrated into invoices etc.  Let me know if you'd like a copy...

5

(10 replies, posted in Wish List)

I am working on a multi-way sync between FA, SuiteCRM, WooCommerce, SquareUp.

SuiteCRM and vTiger share some history.

I have a module for pushing Inventory items to WooCommerce working (for "simple" items i.e. not variations).  I have it also roughed up to send to SuiteCRM.

SuiteCRM has a workflow engine that can trigger on records being saved; I have experimental code for sending Accounts and Contacts data to the API in FA.

My intent is to release these once further testing and code cleanup has occurred.  However at the moment I am working on bookkeeping audits and cleanups so there may be some delay sad

During an audit, I have discovered that there are many items that have been received, have not been invoiced, and do not show up to be invoiced.

I discovered this when comparing pre-payments made to a vendor against the resulting Supplier Invoices.  The Supplier is in a foreign currency, so numbers weren't lining up triggering the audit( Vendor PO in USD <> Vendor Invoice in USD -> FA Invoice in CAD <> Payment in CAD ).  Most of the differences could be accounted for due to fluctuating exchange rate.

However, we found a few invoices where the invoiced totals were significantly different ($100+).  A review of the PO against the Invoice in FA showed items not invoiced.  Going into the Supplier Invoice screen for that supplier, there are no outstanding items to invoice.  However, running

SELECT * FROM 1_purch_order_details WHERE qty_invoiced <> quantity_received;

brings up 439 rows where the qty_invoiced is 0 and quantity_received is greater than 0.

Is there a query or function to be run that will bring these missing items back into the Supplier Invoice screen?

Is there also a way to alert the person entering the invoice that items from the Receive aren't appearing on the invoice?  In this case, because of the FX and the payment made before the items being recieved into FA, it wasn't caught at the time that items were missing since a difference in totals was expected due to changing exchange rates, and therefore a close compare of the FA Invoice total against the Supplier Quoted Total wasn't done.

Does the SlimAPI work on a push out of FA basis? 

When I add or update a customer in FA, I want that details pushed to Suite.  And in Suite, I have a module that will push to the other integration points when it updates records.

Thanks

Greetings all,

I am working on an extension to send customer data from Front Accounting to our newly implemented SuiteCRM instance (and eventually our WooCommerce shop).  I see in the Sales area, there are hook_prewrite and _postwrite calls passing the shopping cart, which would let me send sales data.

I would like to suggest we enhance the other areas of FA similarly.  To this end, I've started in the customer area.  I have defined some new types CT_ADDCUST etc.  I have also added the pre and post hook calls in the 6 routines that add/update/delete customers and branches. 

define('CT_ADDCUST', 50 );
define('CT_UPDATECUST', 51 );
define('CT_DELETECUST', 52 );
define('CT_ADDBRANCH', 55 );
define('CT_UPDATEBRANCH', 56 );
define('CT_DELETEBRANCH', 57 );

To allow this to be upgrade safe and the extension module not needing to know the triggering core module, the types defined in includes/types.inc would need to be renumbered so that each transaction type is unique (they currently restart at 1). (e.g. BT_TRANSFER 1)

Ideally, all of the core modules would pass an object, similar to the CART in the sales area, but an interim step that I have working would be to use func_get_args() to pass an array:

$arr = func_get_args();
hook_db_prewrite( $arr, CT_ADDBRANCH );
db_query(...);
//if there is a returned index value (i.e. on insert) we could add that into the $arr...
hook_db_postwrite( $arr, CT_ADDBRANCH );

I am currently developing against 2.3.22 but also did a quick check in 2.4.1 to see if there had been any changes along this lines in the customer/branch codes.

As I have only started working this, I am very open to ideas on how to architect this, and if anyone can identify reasons for FA to NOT have these enhancements.

Have a great day!

Hi apmuthu,

I am pretty sure that allow negative stock is off.  However, I show 2 as in stock in FA, and I was trying to deliver 2 so the final stock count would not have been negative. 

If I understood the logic in the functions correctly, it was assuming I was delivering all 10 that the customer had ordered when I was trying to deliver the 2 on hand, and leave 8 on back order until the next shipment from my supplier comes in.  I do remember that I had the "leave on backorder" dropdown selected during the delivery process.

I did not do a dependencies check to see what other functions use the check_negative_stock hence one reason for asking about side effects to making that change long term.

I have a customer order for 10 items, and I have 2 in stock.  When I try to deliver the 2 and Place Delivery, I get an error that there isn't enough quantity in stock.

Tracing through the code, I found in customer_delivery.inc it checks $_SESSION['items']->check_qoh which ultimately calls check_negative_stock (cart_class.inc). 

For the quantity for check_negative_stock (line 568) it uses $line_item->quantity.  I suggest it should be using $line_item->qty_dispatched.  This way it is checking for the amount I am trying to deliver, rather than the amount that is not yet delivered.

Have I understood the variables correctly?  Also, are there any side effects from making this change that I may not be aware of?