Changeset 126
- Timestamp:
- 11/15/06 16:37:14 (2 years ago)
- Files:
-
- trunk/com_mls_catering/lang/english.php (modified) (1 diff)
- trunk/com_mls_catering/mls_catering.config.php (modified) (1 diff)
- trunk/com_mls_catering/mls_catering.html.php (modified) (1 diff)
- trunk/com_mls_catering/mls_catering.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/com_mls_catering/lang/english.php
r125 r126 42 42 "err_please_enter_name" => "Please enter a name!", 43 43 "err_please_select_category" => "Please select a category!", 44 "err_please_select_caterer" => "Please select a caterer!"); 44 "err_please_select_caterer" => "Please select a caterer!", 45 "err_not_enough_money_stop" => "You do not have enough money to pay for all or some items. Some items will not have been ordered!", 46 "err_not_enough_money_warn" => "You do not have enough money to pay for all or some items. All your items are ordered but only the ones paid for will be processed!"); 45 47 46 48 $lang_data["catering"] = array( trunk/com_mls_catering/mls_catering.config.php
r88 r126 2 2 $cnf_mls_catering["show_form"] = 1; 3 3 $cnf_mls_catering["currency"] = "GBP"; 4 $cnf_mls_catering["search_default"] = "userid"; 5 $cnf_mls_catering["autopay"] = 0; 6 $cnf_mls_catering["autopay_action"] = "warn"; 4 7 ?> trunk/com_mls_catering/mls_catering.html.php
r88 r126 38 38 $cols = 3; 39 39 ?> 40 <form id="order_form" method="POST" action="index.php">40 <form id="order_form" name="orderForm" method="POST" action="index.php?option=<?php echo $option;?>&Itemid=<?php echo $Itemid;?>&task=order"> 41 41 <?php 42 42 } trunk/com_mls_catering/mls_catering.php
r124 r126 85 85 86 86 function orderItems( $option, $Itemid ) { 87 global $database, $l, $my, $mosConfig_offset ;87 global $database, $l, $my, $mosConfig_offset, $cnf_mls_catering; 88 88 $l->setBlock("general"); 89 89 … … 92 92 $order->userid = $my->id; 93 93 $order->store(); 94 $itemsTotal = 0; 95 $itemsFailed = 0; 94 96 foreach($_POST["amount"] as $id => $amount) { 95 97 if($amount > 0) { 98 $itemsTotal++; 96 99 $oitem = new mosMLS_catering_userorder_item( $database ); 97 $oitem->orderItem( $order->id, $id, $amount ); 100 $itemID = $oitem->orderItem( $order->id, $id, $amount ); 101 unset($oitem); 102 if($cnf_mls_catering["autopay"]) { 103 //Automatically pay item 104 $oitem = new mosMLS_catering_userorder_item( $database ); 105 $oitem->load($itemID); 106 if(!$oitem->payItem($my->id)) { 107 $itemsFailed++; 108 //Payment failed, most likely not enough credit 109 if($cnf_mls_catering["autopay_action"] == "stop") { 110 //You configured not to allow ordering 111 $database->setQuery( "DELETE FROM `#__mls_catering_userorder_items` WHERE `id`='".$oitem->id."'" ); 112 $database->query(); 113 $msg = $l->m("err_not_enough_money_stop","general"); 114 } else { 115 //Just display warning 116 $msg = $l->m("err_not_enough_money_warn","general"); 117 } 118 } 119 } else { 120 //No autopay 121 $msg = $l->m("msg_items_ordered"); 122 } 98 123 } 99 124 } 100 mosRedirect("index.php?option=$option&Itemid=$Itemid&mosmsg=".urlencode($l->m("msg_items_ordered"))); 125 if($itemsFailed == 0) { 126 $msg = $l->m("msg_items_ordered"); 127 } 128 $database->setQuery( "SELECT COUNT(*) FROM `#__mls_catering_userorder_items` WHERE `orderid`='".$order->id."'" ); 129 if(!$database->loadResult()) { 130 //No items exist for the order, might be that he did not have enought money for any of them 131 //So lets remove the actual order 132 $database->setQuery( "DELETE FROM `#__mls_catering_userorders` WHERE `id`='".$order->id."'" ); 133 $database->query(); 134 } 135 136 mosRedirect("index.php?option=$option&Itemid=$Itemid", $msg); 101 137 } 102 138