Hi everyone!
We have create a MySQL stored procedure that can be called this way :
function duplicate_row($primary_key, $row){ $this->db->where('id',$primary_key); $selected_id = $this->db->get('icml_product')->row(); $sp = 'call sp_duplicate_product('.$selected_id.', 0, @output);'; $out = "select @output;"; $this->db->query($sp)->row(); if($this->db->query($out) == '0'){ return 0; }else{ return -1; } }
We add this add_action to our controller :
$crud->add_action('Duplicate', '', '', 'fa-copy', array($this,'duplicate_row'));
But the result in the list view is :
And finaly, the worst is that it create, on load, a copy of the 10 rows without any click on the Duplicate btn! :(
Any idea... I'm a bit lost here!