1 (edited by apmuthu 01/16/2013 11:14:49 pm)

Topic: degrade doctext.inc vars gracefully. hardcoded strings

In sales/includes/db/sales_order_db.inc in the function get_sales_order_header we have a few hardcoded strings:

Line 310: You have duplicate document in database

Line 317: You have missing or invalid sales document in databaseYou have missing or invalid sales document in database

In the demo company, Reports => Customers => Print Sales Quotations results in the following error:

You have missing or invalid sales document in database (type:32, number:0).

The database does not have any demo data for sales quotations - it does not degrade gracefully.

Almost all variables in reporting/inxludes/doctext.inc need to be gracefully degraded like line 40:

$this->formData['document_date'] = this->formData['ord_date'] ;

which should become

$this->formData['document_date'] = isset($this->formData['ord_date']) ? $this->formData['ord_date'] : '';

Re: degrade doctext.inc vars gracefully. hardcoded strings

Hello Apmuthu,

The 2 warnings in line 310 and 317 are from the database. We have decided to report all errors/warnings from database in English only.

The sales quotation and other documents will now break if there are no documents in database.

/Joe

Re: degrade doctext.inc vars gracefully. hardcoded strings

In that case, then the default page to be displayed should be Add New Quotation Form when there are no Quotations in the database - that way we need not bother about the database warning ever occurring here.

Thanks for the clarification.

Re: degrade doctext.inc vars gracefully. hardcoded strings

It has been fixed with the last commit to HG repository for both 2.3 and 2.4.

/Joe