lazymofo / datagrid

PHP MySQL CRUD Datagrid
MIT License
141 stars 57 forks source link

improvement proposal #64

Closed gaful closed 4 years ago

gaful commented 4 years ago

Hello,

May I suggest changing the following code:

     if(mb_strlen($this->identity_name) == 0 || (mb_strlen($this->grid_sql) && mb_strlen($this->table) == 0)){
        $this->display_error("missing grid_sql and table (one is required), or missing identity_name", 'form()');
        return;
    }

to :

     if(mb_strlen($this->identity_name) == 0 || (mb_strlen($this->grid_sql) + mb_strlen($this->table) == 0)){
        $this->display_error("missing grid_sql and table (one is required), or missing identity_name", 'form()');
        return;
    }

Otherwise both grid_sql table are required, and the error message is confusing.

Thank you Gaful

lazymofo commented 4 years ago

Wow, definitely some bad code there. It should be fixed in version 2020-06-07. Thanks for catching that issue!

On Fri, Jun 5, 2020 at 7:52 AM gaful notifications@github.com wrote:

Hello,

May I suggest changing the following code:

 if(mb_strlen($this->identity_name) == 0 || (mb_strlen($this->grid_sql) && mb_strlen($this->table) == 0)){
    $this->display_error("missing grid_sql and table (one is required), or missing identity_name", 'form()');
    return;
}

to :

 if(mb_strlen($this->identity_name) == 0 || (mb_strlen($this->grid_sql) + mb_strlen($this->table) == 0)){
    $this->display_error("missing grid_sql and table (one is required), or missing identity_name", 'form()');
    return;
}

Otherwise both grid_sql table are required, and the error message is confusing.

Thank you Gaful

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lazymofo/datagrid/issues/64, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRM2WAMTXM5PRNC76ZTF4DRVEBDVANCNFSM4NTXWH3A .

gaful commented 4 years ago

thanks works well