1
0

Minor cleanup (whitespace, comments)

This commit is contained in:
Jeroen ten kate 2012-12-27 21:31:27 +01:00
parent 8eec645c40
commit 36d84001a2
4 changed files with 69 additions and 72 deletions

View File

@ -187,8 +187,8 @@ class Basket_Controller extends Controller {
if ($order->loaded()){ if ($order->loaded()){
//Send order copy //Send order copy
basket::send_invoice_copy($order); basket::send_invoice_copy($order);
order_log::log($order,order_log::COPY_SENT); order_log::log($order,order_log::COPY_SENT);
} }
url::redirect("basket/view_orders"); url::redirect("basket/view_orders");
} }
@ -202,16 +202,16 @@ class Basket_Controller extends Controller {
if ($order->status == 1) if ($order->status == 1)
{ {
$order->status = 2; $order->status = 2;
order_log::log($order,order_log::PAID); order_log::log($order,order_log::PAID);
} }
elseif ($order->status == 10) elseif ($order->status == 10)
{ {
$order->status = 20; $order->status = 20;
order_log::log($order,order_log::PAID); order_log::log($order,order_log::PAID);
} }
$order->save(); $order->save();
//Send payment confirmation //Send payment confirmation
basket::send_payment_confirmation($order); basket::send_payment_confirmation($order);
} }
url::redirect("basket/view_orders"); url::redirect("basket/view_orders");
} }
@ -282,38 +282,38 @@ class Basket_Controller extends Controller {
private function getCheckoutForm(){ private function getCheckoutForm(){
$basket = Session_Basket::get(); $basket = Session_Basket::get();
$ppon = $basket->ispp(); $ppon = $basket->ispp();
$postage = $basket->postage_cost(); $postage = $basket->postage_cost();
//labels for fields //labels for fields
$input1_lbl=t("Title"); $input1_lbl=t("Title");
$input2_lbl=t("Initials/First name")."*"; $input2_lbl=t("Initials/First name")."*";
$input3_lbl=t("Insertion"); $input3_lbl=t("Insertion");
$input4_lbl=t("Name")."*"; $input4_lbl=t("Name")."*";
$input5_lbl=t("Street"); $input5_lbl=t("Street");
$input6_lbl=t("House Number / Name"); $input6_lbl=t("House Number / Name");
$input7_lbl=t("Suburb"); $input7_lbl=t("Suburb");
$input8_lbl=t("Postcode"); $input8_lbl=t("Postcode");
$input9_lbl=t("Town or City"); $input9_lbl=t("Town or City");
$input10_lbl=t("E-mail Address")."*"; $input10_lbl=t("E-mail Address")."*";
$input11_lbl=t("Telephone Number")."*"; $input11_lbl=t("Telephone Number")."*";
$input12_lbl=t("Child's Name"); $input12_lbl=t("Child's Name");
$input13_lbl=t("Child's Group"); $input13_lbl=t("Child's Group");
$input14_lbl=t("Additional comments"); $input14_lbl=t("Additional comments");
$input15_lbl=t("I agree with the General Terms")."*"; $input15_lbl=t("I agree with the General Terms")."*";
//labels for mandatory fields with p&p //labels for mandatory fields with p&p
if (($ppon) && ($postage > 0)){ if (($ppon) && ($postage > 0)){
$input5_lbl=$input5_lbl."*"; $input5_lbl=$input5_lbl."*";
$input6_lbl=$input6_lbl."*"; $input6_lbl=$input6_lbl."*";
$input8_lbl=$input8_lbl."*"; $input8_lbl=$input8_lbl."*";
$input9_lbl=$input9_lbl."*"; $input9_lbl=$input9_lbl."*";
} }
//labels for mandatory fields with pickup //labels for mandatory fields with pickup
elseif ($postage > 0){ elseif ($postage > 0){
$input12_lbl=$input12_lbl."*"; $input12_lbl=$input12_lbl."*";
$input13_lbl=$input13_lbl."*"; $input13_lbl=$input13_lbl."*";
} }
$form = new Forge("basket/confirm", "", "post", array("id" => "checkout", "name" =>"checkout")); $form = new Forge("basket/confirm", "", "post", array("id" => "checkout", "name" =>"checkout"));
$group = $form->group("contact")->label(t("Contact Details")); $group = $form->group("contact")->label(t("Contact Details"));
$group->input("title")->label($input1_lbl)->id("title"); $group->input("title")->label($input1_lbl)->id("title");
@ -329,14 +329,14 @@ class Basket_Controller extends Controller {
$group->input("phone")->label($input11_lbl)->id("phone"); $group->input("phone")->label($input11_lbl)->id("phone");
//show child fields only with pickup DISABLED //show child fields only with pickup DISABLED
if ((!$ppon) && ($postage > 1000)){ if ((!$ppon) && ($postage > 1000)){
$group->input("childname")->label($input12_lbl)->id("childname"); $group->input("childname")->label($input12_lbl)->id("childname");
$group->input("childgroup")->label($input13_lbl)->id("childgroup"); $group->input("childgroup")->label($input13_lbl)->id("childgroup");
} }
else{ else{
$group->hidden("childname")->label($input12_lbl)->id("childname"); $group->hidden("childname")->label($input12_lbl)->id("childname");
$group->hidden("childgroup")->label($input13_lbl)->id("childgroup"); $group->hidden("childgroup")->label($input13_lbl)->id("childgroup");
} }
$group->input("comments")->label($input14_lbl)->id("comments"); $group->input("comments")->label($input14_lbl)->id("comments");
$group->checkbox("agreeterms")->label($input15_lbl)->id("agreeterms"); $group->checkbox("agreeterms")->label($input15_lbl)->id("agreeterms");
$group->hidden("paypal")->id("paypal"); $group->hidden("paypal")->id("paypal");
@ -402,8 +402,8 @@ class Basket_Controller extends Controller {
$basket->suburb = $form->contact->suburb->value; $basket->suburb = $form->contact->suburb->value;
$basket->email = $form->contact->email->value; $basket->email = $form->contact->email->value;
$basket->phone = $form->contact->phone->value; $basket->phone = $form->contact->phone->value;
$basket->childname = $form->contact->childname->value; $basket->childname = $form->contact->childname->value;
$basket->childgroup = $form->contact->childgroup->value; $basket->childgroup = $form->contact->childgroup->value;
$basket->comments = $form->contact->comments->value; $basket->comments = $form->contact->comments->value;
$basket->agreeterms=$form->contact->agreeterms->value; $basket->agreeterms=$form->contact->agreeterms->value;
@ -427,8 +427,8 @@ class Basket_Controller extends Controller {
// redirect to paypal // redirect to paypal
// NOT USED END =============================== // NOT USED END ===============================
}else }
{ else{
$form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" =>"confirm")); $form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" =>"confirm"));
$view = new View("confirm_order.html"); $view = new View("confirm_order.html");
$view->basket = $basket; $view->basket = $basket;
@ -437,8 +437,7 @@ class Basket_Controller extends Controller {
print $template; print $template;
} }
} }
else else{
{
die("Invalid confirmation!"); die("Invalid confirmation!");
} }
} }

View File

@ -162,7 +162,7 @@ class basket_Core {
$form->configure->paypal_account->value(basket::getPaypalAccount()); $form->configure->paypal_account->value(basket::getPaypalAccount());
$form->configure->currency->selected(basket::getCurrency()); $form->configure->currency->selected(basket::getCurrency());
$form->configure->allow_pickup->checked(basket::isAllowPickup()); $form->configure->allow_pickup->checked(basket::isAllowPickup());
$form->configure->pickup_location->value(basket::getPickupLocation()); $form->configure->pickup_location->value(basket::getPickupLocation());
$form->configure->order_prefix->value(basket::getOrderPrefix()); $form->configure->order_prefix->value(basket::getOrderPrefix());
$form->configure->order_bankaccount->value(basket::getOrderBankAccount()); $form->configure->order_bankaccount->value(basket::getOrderBankAccount());
$form->configure->order_accountowner->value(basket::getOrderAccountOwner()); $form->configure->order_accountowner->value(basket::getOrderAccountOwner());
@ -197,7 +197,7 @@ class basket_Core {
$paypal_account = $form->configure->paypal_account->value; $paypal_account = $form->configure->paypal_account->value;
$currency = $form->configure->currency->selected; $currency = $form->configure->currency->selected;
$allow_pickup = $form->configure->allow_pickup->value; $allow_pickup = $form->configure->allow_pickup->value;
$pickup_location = $form->configure->pickup_location->value; $pickup_location = $form->configure->pickup_location->value;
$order_prefix = $form->configure->order_prefix->value; $order_prefix = $form->configure->order_prefix->value;
$order_bankaccount = $form->configure->order_bankaccount->value; $order_bankaccount = $form->configure->order_bankaccount->value;
$order_accountowner = $form->configure->order_accountowner->value; $order_accountowner = $form->configure->order_accountowner->value;
@ -291,12 +291,12 @@ class basket_Core {
* Get pickup location from user profile unless it's empty. Then get it from the general settings. * Get pickup location from user profile unless it's empty. Then get it from the general settings.
*/ */
static function getPickupLocation(){ static function getPickupLocation(){
$user = identity::active_user(); $user = identity::active_user();
$user_basket = ORM::factory("user_basket")->where("id", "=", $user->id)->find(); $user_basket = ORM::factory("user_basket")->where("id", "=", $user->id)->find();
$pickup_location = $user_basket->pickup_location; $pickup_location = $user_basket->pickup_location;
if (($pickup_location == "") or ($pickup_location == null)) { if (($pickup_location == "") or ($pickup_location == null)) {
$pickup_location = module::get_var("basket","pickup_location");} $pickup_location = module::get_var("basket","pickup_location");}
return $pickup_location; return $pickup_location;
} }
static function getPaymentDetails(){ static function getPaymentDetails(){
@ -319,7 +319,7 @@ class basket_Core {
return module::get_var("basket","allow_pickup"); return module::get_var("basket","allow_pickup");
} }
static function getOrderCompletePage(){ static function getOrderCompletePage(){
return module::get_var("basket","order_complete_page"); return module::get_var("basket","order_complete_page");
} }
@ -333,6 +333,7 @@ class basket_Core {
static function getOrderPaidEmail(){ static function getOrderPaidEmail(){
return module::get_var("basket","order_paid_email"); return module::get_var("basket","order_paid_email");
} }
static function getOrderPaidEmailSubject(){ static function getOrderPaidEmailSubject(){
return module::get_var("basket","order_paid_email_subject"); return module::get_var("basket","order_paid_email_subject");
} }
@ -405,16 +406,16 @@ class basket_Core {
//Added 2011-10-02 //Added 2011-10-02
static function replaceStringsAll($string, $order) { static function replaceStringsAll($string, $order) {
$string_new = basket::replaceStrings($string,Array( $string_new = basket::replaceStrings($string,Array(
"name"=>$order->name, "name"=>$order->name,
"order_number"=> basket::getOrderPrefix().$order->id, "order_number"=> basket::getOrderPrefix().$order->id,
"total_cost" => basket::formatMoneyForMail($order->cost), "total_cost" => basket::formatMoneyForMail($order->cost),
"order_details"=> $order->text, "order_details"=> $order->text,
"email"=>basket::getEmailAddress(), "email"=>basket::getEmailAddress(),
"pickup_location"=> basket::getPickupLocation(), "pickup_location"=> basket::getPickupLocation(),
"website"=> basket::getWebsite(), "website"=> basket::getWebsite(),
"webshop"=> basket::getWebshop())); "webshop"=> basket::getWebshop()));
return $string_new; return $string_new;
} }
//Added 2011-10-02 //Added 2011-10-02
@ -428,13 +429,13 @@ class basket_Core {
//Added 2011-10-02 //Added 2011-10-02
static function deliveryMethod($order) { static function deliveryMethod($order) {
//@TODO: configurable delivery methods //@TODO: configurable delivery methods
if ($order->method == Order_Model::DELIVERY_MAIL) {$delivery_method = "verstuurd per post";} if ($order->method == Order_Model::DELIVERY_MAIL) {$delivery_method = "verstuurd per post";}
elseif ($order->method == Order_Model::DELIVERY_EMAIL) {$delivery_method = "verstuurd per e-mail";} elseif ($order->method == Order_Model::DELIVERY_EMAIL) {$delivery_method = "verstuurd per e-mail";}
elseif ($order->method == Order_Model::DELIVERY_PICKUP) {$delivery_method = "klaargelegd om af te halen bij ".basket::getPickupLocation()."";} elseif ($order->method == Order_Model::DELIVERY_PICKUP) {$delivery_method = "klaargelegd om af te halen bij ".basket::getPickupLocation()."";}
else {$delivery_method = "GEEN LEVERINGSWIJZE BEKEND";} else {$delivery_method = "GEEN LEVERINGSWIJZE BEKEND";}
return $delivery_method; return $delivery_method;
} }
static function setWebshop($webshop){ static function setWebshop($webshop){
module::set_var("basket","webshop",$webshop); module::set_var("basket","webshop",$webshop);
@ -542,7 +543,6 @@ class basket_Core {
} }
static function createOrder($basket, $method){ static function createOrder($basket, $method){
// fill customer record; added 2011-08-20 // fill customer record; added 2011-08-20
$customer = ORM::factory("customer"); $customer = ORM::factory("customer");
$customer->title=$basket->title; $customer->title=$basket->title;
@ -697,7 +697,7 @@ Bestelde foto's:";
} }
public function send_invoice_copy($order){ public function send_invoice_copy($order){
// order confirmation mail to customer // copy of order confirmation mail to customer
$to = $order->email; $to = $order->email;
$from = "From: ".basket::getEmailAddress(); $from = "From: ".basket::getEmailAddress();
$subject = basket::replaceStringsAll(basket::getOrderCompleteEmailSubject(),$order); $subject = basket::replaceStringsAll(basket::getOrderCompleteEmailSubject(),$order);

View File

@ -61,7 +61,7 @@ class basket_installer
$db->query("CREATE TABLE IF NOT EXISTS {orders} ( $db->query("CREATE TABLE IF NOT EXISTS {orders} (
`id` int(9) NOT NULL auto_increment, `id` int(9) NOT NULL auto_increment,
`customerid` int(9) NOT NULL, `customerid` int(9) NOT NULL,
`status` int(9) DEFAULT 0, `status` int(9) DEFAULT 0,
`name` varchar(512), `name` varchar(512),
`email` varchar(256), `email` varchar(256),
`cost` DECIMAL(10,2) default 0, `cost` DECIMAL(10,2) default 0,

View File

@ -73,10 +73,8 @@ class Order_Model extends ORM {
//return "offline"; //return "offline";
return "Overmaking - versturen per post"; return "Overmaking - versturen per post";
case 3: case 3:
//return "offline";
return "Overmaking - versturen per e-mail"; return "Overmaking - versturen per e-mail";
case 4: case 4:
//return "offline";
return "Overmaking - afhalen"; return "Overmaking - afhalen";
default: default: