diff --git a/3.0/modules/basket_plus/controllers/basket.php b/3.0/modules/basket_plus/controllers/basket.php index 004827ee..4e204da1 100644 --- a/3.0/modules/basket_plus/controllers/basket.php +++ b/3.0/modules/basket_plus/controllers/basket.php @@ -187,8 +187,8 @@ class Basket_Controller extends Controller { if ($order->loaded()){ //Send order copy - basket::send_invoice_copy($order); - order_log::log($order,order_log::COPY_SENT); + basket::send_invoice_copy($order); + order_log::log($order,order_log::COPY_SENT); } url::redirect("basket/view_orders"); } @@ -202,16 +202,16 @@ class Basket_Controller extends Controller { if ($order->status == 1) { $order->status = 2; - order_log::log($order,order_log::PAID); + order_log::log($order,order_log::PAID); } elseif ($order->status == 10) { $order->status = 20; - order_log::log($order,order_log::PAID); + order_log::log($order,order_log::PAID); } $order->save(); //Send payment confirmation - basket::send_payment_confirmation($order); + basket::send_payment_confirmation($order); } url::redirect("basket/view_orders"); } @@ -282,38 +282,38 @@ class Basket_Controller extends Controller { private function getCheckoutForm(){ - $basket = Session_Basket::get(); - $ppon = $basket->ispp(); - $postage = $basket->postage_cost(); + $basket = Session_Basket::get(); + $ppon = $basket->ispp(); + $postage = $basket->postage_cost(); //labels for fields - $input1_lbl=t("Title"); - $input2_lbl=t("Initials/First name")."*"; - $input3_lbl=t("Insertion"); - $input4_lbl=t("Name")."*"; - $input5_lbl=t("Street"); - $input6_lbl=t("House Number / Name"); - $input7_lbl=t("Suburb"); - $input8_lbl=t("Postcode"); - $input9_lbl=t("Town or City"); - $input10_lbl=t("E-mail Address")."*"; - $input11_lbl=t("Telephone Number")."*"; - $input12_lbl=t("Child's Name"); - $input13_lbl=t("Child's Group"); - $input14_lbl=t("Additional comments"); - $input15_lbl=t("I agree with the General Terms")."*"; + $input1_lbl=t("Title"); + $input2_lbl=t("Initials/First name")."*"; + $input3_lbl=t("Insertion"); + $input4_lbl=t("Name")."*"; + $input5_lbl=t("Street"); + $input6_lbl=t("House Number / Name"); + $input7_lbl=t("Suburb"); + $input8_lbl=t("Postcode"); + $input9_lbl=t("Town or City"); + $input10_lbl=t("E-mail Address")."*"; + $input11_lbl=t("Telephone Number")."*"; + $input12_lbl=t("Child's Name"); + $input13_lbl=t("Child's Group"); + $input14_lbl=t("Additional comments"); + $input15_lbl=t("I agree with the General Terms")."*"; //labels for mandatory fields with p&p if (($ppon) && ($postage > 0)){ - $input5_lbl=$input5_lbl."*"; - $input6_lbl=$input6_lbl."*"; - $input8_lbl=$input8_lbl."*"; - $input9_lbl=$input9_lbl."*"; + $input5_lbl=$input5_lbl."*"; + $input6_lbl=$input6_lbl."*"; + $input8_lbl=$input8_lbl."*"; + $input9_lbl=$input9_lbl."*"; } //labels for mandatory fields with pickup - elseif ($postage > 0){ - $input12_lbl=$input12_lbl."*"; - $input13_lbl=$input13_lbl."*"; - } + elseif ($postage > 0){ + $input12_lbl=$input12_lbl."*"; + $input13_lbl=$input13_lbl."*"; + } $form = new Forge("basket/confirm", "", "post", array("id" => "checkout", "name" =>"checkout")); $group = $form->group("contact")->label(t("Contact Details")); $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"); //show child fields only with pickup DISABLED if ((!$ppon) && ($postage > 1000)){ - $group->input("childname")->label($input12_lbl)->id("childname"); - $group->input("childgroup")->label($input13_lbl)->id("childgroup"); + $group->input("childname")->label($input12_lbl)->id("childname"); + $group->input("childgroup")->label($input13_lbl)->id("childgroup"); } - else{ - $group->hidden("childname")->label($input12_lbl)->id("childname"); - $group->hidden("childgroup")->label($input13_lbl)->id("childgroup"); + else{ + $group->hidden("childname")->label($input12_lbl)->id("childname"); + $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->hidden("paypal")->id("paypal"); @@ -402,8 +402,8 @@ class Basket_Controller extends Controller { $basket->suburb = $form->contact->suburb->value; $basket->email = $form->contact->email->value; $basket->phone = $form->contact->phone->value; - $basket->childname = $form->contact->childname->value; - $basket->childgroup = $form->contact->childgroup->value; + $basket->childname = $form->contact->childname->value; + $basket->childgroup = $form->contact->childgroup->value; $basket->comments = $form->contact->comments->value; $basket->agreeterms=$form->contact->agreeterms->value; @@ -427,8 +427,8 @@ class Basket_Controller extends Controller { // redirect to paypal // NOT USED END =============================== - }else - { + } + else{ $form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" =>"confirm")); $view = new View("confirm_order.html"); $view->basket = $basket; @@ -437,8 +437,7 @@ class Basket_Controller extends Controller { print $template; } } - else - { + else{ die("Invalid confirmation!"); } } diff --git a/3.0/modules/basket_plus/helpers/basket.php b/3.0/modules/basket_plus/helpers/basket.php index e8abe6e7..606d0d3e 100644 --- a/3.0/modules/basket_plus/helpers/basket.php +++ b/3.0/modules/basket_plus/helpers/basket.php @@ -162,7 +162,7 @@ class basket_Core { $form->configure->paypal_account->value(basket::getPaypalAccount()); $form->configure->currency->selected(basket::getCurrency()); $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_bankaccount->value(basket::getOrderBankAccount()); $form->configure->order_accountowner->value(basket::getOrderAccountOwner()); @@ -197,7 +197,7 @@ class basket_Core { $paypal_account = $form->configure->paypal_account->value; $currency = $form->configure->currency->selected; $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_bankaccount = $form->configure->order_bankaccount->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. */ static function getPickupLocation(){ - $user = identity::active_user(); - $user_basket = ORM::factory("user_basket")->where("id", "=", $user->id)->find(); - $pickup_location = $user_basket->pickup_location; - if (($pickup_location == "") or ($pickup_location == null)) { - $pickup_location = module::get_var("basket","pickup_location");} - return $pickup_location; + $user = identity::active_user(); + $user_basket = ORM::factory("user_basket")->where("id", "=", $user->id)->find(); + $pickup_location = $user_basket->pickup_location; + if (($pickup_location == "") or ($pickup_location == null)) { + $pickup_location = module::get_var("basket","pickup_location");} + return $pickup_location; } static function getPaymentDetails(){ @@ -319,7 +319,7 @@ class basket_Core { return module::get_var("basket","allow_pickup"); } - static function getOrderCompletePage(){ + static function getOrderCompletePage(){ return module::get_var("basket","order_complete_page"); } @@ -333,6 +333,7 @@ class basket_Core { static function getOrderPaidEmail(){ return module::get_var("basket","order_paid_email"); } + static function getOrderPaidEmailSubject(){ return module::get_var("basket","order_paid_email_subject"); } @@ -405,16 +406,16 @@ class basket_Core { //Added 2011-10-02 static function replaceStringsAll($string, $order) { - $string_new = basket::replaceStrings($string,Array( - "name"=>$order->name, - "order_number"=> basket::getOrderPrefix().$order->id, - "total_cost" => basket::formatMoneyForMail($order->cost), - "order_details"=> $order->text, - "email"=>basket::getEmailAddress(), - "pickup_location"=> basket::getPickupLocation(), - "website"=> basket::getWebsite(), - "webshop"=> basket::getWebshop())); - return $string_new; + $string_new = basket::replaceStrings($string,Array( + "name"=>$order->name, + "order_number"=> basket::getOrderPrefix().$order->id, + "total_cost" => basket::formatMoneyForMail($order->cost), + "order_details"=> $order->text, + "email"=>basket::getEmailAddress(), + "pickup_location"=> basket::getPickupLocation(), + "website"=> basket::getWebsite(), + "webshop"=> basket::getWebshop())); + return $string_new; } //Added 2011-10-02 @@ -428,13 +429,13 @@ class basket_Core { //Added 2011-10-02 static function deliveryMethod($order) { -//@TODO: configurable delivery methods - if ($order->method == Order_Model::DELIVERY_MAIL) {$delivery_method = "verstuurd per post";} + //@TODO: configurable delivery methods + 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_PICKUP) {$delivery_method = "klaargelegd om af te halen bij ".basket::getPickupLocation()."";} - else {$delivery_method = "GEEN LEVERINGSWIJZE BEKEND";} - return $delivery_method; -} + else {$delivery_method = "GEEN LEVERINGSWIJZE BEKEND";} + return $delivery_method; + } static function setWebshop($webshop){ module::set_var("basket","webshop",$webshop); @@ -542,7 +543,6 @@ class basket_Core { } static function createOrder($basket, $method){ - // fill customer record; added 2011-08-20 $customer = ORM::factory("customer"); $customer->title=$basket->title; @@ -697,7 +697,7 @@ Bestelde foto's:"; } public function send_invoice_copy($order){ - // order confirmation mail to customer + // copy of order confirmation mail to customer $to = $order->email; $from = "From: ".basket::getEmailAddress(); $subject = basket::replaceStringsAll(basket::getOrderCompleteEmailSubject(),$order); diff --git a/3.0/modules/basket_plus/helpers/basket_installer.php b/3.0/modules/basket_plus/helpers/basket_installer.php index a8e96b20..39a7f79c 100644 --- a/3.0/modules/basket_plus/helpers/basket_installer.php +++ b/3.0/modules/basket_plus/helpers/basket_installer.php @@ -61,7 +61,7 @@ class basket_installer $db->query("CREATE TABLE IF NOT EXISTS {orders} ( `id` int(9) NOT NULL auto_increment, `customerid` int(9) NOT NULL, - `status` int(9) DEFAULT 0, + `status` int(9) DEFAULT 0, `name` varchar(512), `email` varchar(256), `cost` DECIMAL(10,2) default 0, diff --git a/3.0/modules/basket_plus/models/order.php b/3.0/modules/basket_plus/models/order.php index f6295e15..c84e8fd0 100644 --- a/3.0/modules/basket_plus/models/order.php +++ b/3.0/modules/basket_plus/models/order.php @@ -73,10 +73,8 @@ class Order_Model extends ORM { //return "offline"; return "Overmaking - versturen per post"; case 3: - //return "offline"; return "Overmaking - versturen per e-mail"; case 4: - //return "offline"; return "Overmaking - afhalen"; default: