Convert the favorites module to the new json::reply helper. **Note** this module doesn't install as it gets a ORM validation error.
This commit is contained in:
parent
115ae046a4
commit
a8c232a752
@ -60,9 +60,9 @@ class Admin_Postage_Bands_Controller extends Controller
|
||||
$postage_band->save();
|
||||
message::success(t("Created postage band %postage_name", array(
|
||||
"postage_name" => html::clean($postage_band->name))));
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,13 +91,13 @@ class Admin_Postage_Bands_Controller extends Controller
|
||||
$name = $postage->name;
|
||||
$postage->delete();
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
}
|
||||
|
||||
$message = t("Deleted user %postage_band", array("postage_band" => html::clean($name)));
|
||||
log::success("user", $message);
|
||||
message::success($message);
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
|
||||
public function edit_postage_band($id) {
|
||||
@ -127,9 +127,9 @@ class Admin_Postage_Bands_Controller extends Controller
|
||||
$postage->save();
|
||||
message::success(t("Changed postage band %postage_name",
|
||||
array("postage_name" => html::clean($postage->name))));
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,9 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
$product->save();
|
||||
message::success(t("Created product %product_name", array(
|
||||
"product_name" => html::clean($product->name))));
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,14 +91,14 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
$name = $product->name;
|
||||
$product->delete();
|
||||
} else {
|
||||
print json_encode(array("result" => "error",
|
||||
json::reply(array("result" => "error",
|
||||
"form" => $form->__toString()));
|
||||
}
|
||||
|
||||
$message = t("Deleted user %product_name", array("product_name" => html::clean($name)));
|
||||
log::success("user", $message);
|
||||
message::success($message);
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
|
||||
public function edit_product($id) {
|
||||
@ -129,9 +129,9 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
$product->save();
|
||||
message::success(t("Changed product %product_name",
|
||||
array("product_name" => html::clean($product->name))));
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ Items Ordered:
|
||||
$form->add_to_basket->product->value,
|
||||
$form->add_to_basket->quantity->value);
|
||||
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user