Topic: White screen on Supplier Invoices and Supplier Credit Notes

Supplier Invoices and Supplier Credit Notes appear as white screen on fresh install without demo data.

Fixes:

Perhaps function check_db_has_suppliers() was called before the function page() called.

Phuong

Re: White screen on Supplier Invoices and Supplier Credit Notes

The check must be called before displaying the page so that any alerts can be shown in it. It should degrade gracefully on no suppliers.

Does this happen for attempting a new sales Direct Invoice when there are no customers?

Re: White screen on Supplier Invoices and Supplier Credit Notes

Yes, it occurs when create new invoice or credit note while no supplier defined.

Phuong

Re: White screen on Supplier Invoices and Supplier Credit Notes

I think the check must be called after the page display because it calls end_page


function check_db_has_suppliers($msg)
{
    global $path_to_root;
    if (!db_has_suppliers())
    {
        display_error($msg, true);
        end_page();
        exit;   
    }   
}

Phuong

Re: White screen on Supplier Invoices and Supplier Credit Notes

Will have a look.

/Joe

Re: White screen on Supplier Invoices and Supplier Credit Notes

The call to check_db_has_suppliers() is moved down a bit in both files.

Committed to stable repo.

/Joe

Re: White screen on Supplier Invoices and Supplier Credit Notes

Isn't it better to implement it likecheck_db_has_customers()inincludes/data_checks.incand as used insales/customer_payments.phpandsales/manage/customer_branches.php? That is how it is now after the commit!

Re: White screen on Supplier Invoices and Supplier Credit Notes

The same algorithms are used on both customer and supplier side. On the customer side it is first checked for items and then customers/branches.

On the supplier side we can't check for items because this may be new items.

I guess this is ok to go this way. It has been done so for many years.

Joe

Re: White screen on Supplier Invoices and Supplier Credit Notes

Just checked all instances of the check_db_has_XXXX() usage in such files  - they are all called after the page() call. It is also so in FA 2.3. Wonder what prompted the change in FA 2.4 to error out thus.

@notrinos: nice eagle eye!
@joe: Thanks for the clarifications.