Master/Detail Add vs Grid-Add (blank rows error)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
strustam
User
Posts: 34
Location: Tajikistan

Master/Detail Add vs Grid-Add (blank rows error)

Post by strustam »

Hi!

When entering data Master/Detail, if there are blank rows, they are ignored and only filled lines are saved to DataBase.
When entering data by grid-add, the same operation requires filling the remaining blank rows with data or deleting them.
I have this issue in my project also I checked this in Demo24, at Orders/Order detail
How it could be solved for grid-add

Thanks in advance


arbei
User
Posts: 9384

Post by arbei »

Master/Detail-Grid and Grid-Add uses the same code to check blank rows. If you have default values for fields in the project (not in database), they are filled in the Grid-Add form, so the rows are not blank.


strustam
User
Posts: 34
Location: Tajikistan

Post by strustam »

Thanks for direction to the research.

Some clarification from my side

The Demo24, Order_detail has 3 field with default values (UnitPrice 0, Quantity 1, Discount 0).
I can fill few of 5 rows at Master/Detail form, and could not do the same at Grid-Add form.

I open Orders form, after that go to preview of Order Details, click to Grid-Add

I found this function in the orderdetailslist:

    public function emptyRow()
    {
        global $CurrentForm;
/*        if ($CurrentForm->hasValue("x_OrderID") && $CurrentForm->hasValue("o_OrderID") && $this->OrderID->CurrentValue != $this->OrderID->DefaultValue) {
            return false;
        }
*/
        if ($CurrentForm->hasValue("x_ProductID") && $CurrentForm->hasValue("o_ProductID") && $this->ProductID->CurrentValue != $this->ProductID->DefaultValue) {
            return false;
        }

As can be seen from the code, default values can be ignored and the row will be considered empty. But the field OrderID relation link to Master table orders prevents this function from accepting this line as empty, since it seems to me that it is not considered as default value
As soon as I commented out the if statement for OrderID, empty lines began to be ignored and did not generate errors. I'm not sure that my changes will affect the rest of the functionality.
Question to developers: Is it possible to remove checking empty status of related to master fields from function emptyRow() or make that values as default and integrate it to template


mobhar
User
Posts: 11726

Post by mobhar »

strustram wrote:

Question to developers: Is it possible to remove checking empty status of related to master fields from function emptyRow() or make that values as default and integrate it to template

You may create your own Extension if you want to change the logic/code from the template side.


Post Reply