more query fixing
This commit is contained in:
parent
c0747e387e
commit
8b64d2b06d
@ -44,11 +44,11 @@ class Crunchbutton_Dish extends Cana_Table_Trackchange {
|
||||
`option`
|
||||
LEFT JOIN dish_option using(id_option)
|
||||
WHERE
|
||||
id_dish="'.$this->id_dish.'"
|
||||
id_dish=?
|
||||
ORDER BY
|
||||
option.type desc,
|
||||
dish_option.sort ASC, option.name
|
||||
');
|
||||
', [$this->id_dish]);
|
||||
}
|
||||
if (gettype($this->_options) == 'array') {
|
||||
$this->_options = i::o($this->_options);
|
||||
@ -67,7 +67,7 @@ class Crunchbutton_Dish extends Cana_Table_Trackchange {
|
||||
* @todo We should probably show a flash message about that
|
||||
*/
|
||||
public function delete() {
|
||||
$od = Order_Dish::q('select * from order_dish where id_order is not null and id_dish="'.$this->id_dish.'"');
|
||||
$od = Order_Dish::q('select * from order_dish where id_order is not null and id_dish=?', [$this->id_dish]);
|
||||
|
||||
if (!$od->count()) {
|
||||
parent::delete();
|
||||
|
||||
@ -13,7 +13,7 @@ class Crunchbutton_Order_Dish extends Cana_Table {
|
||||
FROM
|
||||
dish_option d INNER JOIN `option` o ON o.id_option = d.id_option
|
||||
WHERE
|
||||
d.id_dish = ' . $this->id_dish . '
|
||||
d.id_dish = ?
|
||||
AND
|
||||
o.type = "check"
|
||||
AND
|
||||
@ -21,12 +21,12 @@ class Crunchbutton_Order_Dish extends Cana_Table {
|
||||
AND
|
||||
o.id_option_parent IS NULL
|
||||
AND
|
||||
d.id_option NOT IN ( SELECT id_option FROM order_dish_option WHERE id_order_dish = ' . $this->id_order_dish . ' )';
|
||||
return Dish_Option::q($query);
|
||||
d.id_option NOT IN ( SELECT id_option FROM order_dish_option WHERE id_order_dish = ? )';
|
||||
return Dish_Option::q($query, [$this->id_dish, $this->id_order_dish]);
|
||||
}
|
||||
|
||||
public function dish() {
|
||||
return Dish::q('select * from dish where id_dish="'.$this->id_dish.'"');
|
||||
return Dish::q('select * from dish where id_dish=?', [$this->id_dish]);
|
||||
}
|
||||
|
||||
public function exports() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user