Jump to content


buslik

Member Since 15 Jul 2013
Offline Last Active Private
-----

Posts I've Made

In Topic: Puzzled with relation 1 to n

16 July 2013 - 12:48 PM

Should I submit this fix to git?


In Topic: Puzzled with relation 1 to n

16 July 2013 - 11:08 AM

Fixed by next patch in application\models\grocery_crud_model.php

$select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE($related_table.",", ''),'"),str_replace("'","\'",$related_field_title))."') as $field_name_hash";

In Topic: Puzzled with relation 1 to n

16 July 2013 - 10:52 AM

Dear davidoster

 

Thank you for reply.

 

But in my case I need many tests were corresponding to one requirement.

 

So I keep DB as it is, but changed controller;

 $this->grocery_crud->set_table('accTest');
		$this->grocery_crud->set_relation('reqId','req','{id} {desc}'); 
        $output = $this->grocery_crud->render();

it works for view but fails on edit with next message:

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, ''), '') as s62b319d1 FROM (`req`) ORDER BY `s62b319d1`' at line 1

SELECT req.id, CONCAT('', COALESCE(id, ''), ' ', COALESCE(desc, ''), '') as s62b319d1 FROM (`req`) ORDER BY `s62b319d1`

Filename: /home/buslik/www/req/models/grocery_crud_model.php

Line Number: 276

to fix it I have changed controller to

$this->grocery_crud->set_table('accTest');
		$this->grocery_crud->set_relation('reqId','req','{req.id} {req.desc}'); 
        $output = $this->grocery_crud->render();

But this broke view sql

Error Number: 1054

Unknown column 'j62b319d1.req.id' in 'field list'

SELECT `accTest`.*, CONCAT('', COALESCE(j62b319d1.req.id, ''), ' ', COALESCE(j62b319d1.req.desc, ''), '') as s62b319d1 FROM (`accTest`) LEFT JOIN `req` as j62b319d1 ON `j62b319d1`.`id` = `accTest`.`reqId` LIMIT 25

Filename: /home/buslik/www/req/models/grocery_crud_model.php

Line Number: 87

my mysql is

| innodb_version          | 1.1.8                   |
| protocol_version        | 10                      |
| version                 | 5.5.28-0ubuntu0.12.04.3 |

In Topic: Puzzled with relation 1 to n

15 July 2013 - 02:18 PM

Ok. May be I can do it in other way. Can I add custom button with url on each line of the greed?