[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // |zen-cart Open Source E-commerce | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003 The zen-cart developers | 7 // | | 8 // | http://www.zen-cart.com/index.php | 9 // | | 10 // | Portions Copyright (c) 2003 osCommerce | 11 // +----------------------------------------------------------------------+ 12 // | This source file is subject to version 2.0 of the GPL license, | 13 // | that is bundled with this package in the file LICENSE, and is | 14 // | available through the world-wide-web at the following url: | 15 // | http://www.zen-cart.com/license/2_0.txt. | 16 // | If you did not receive a copy of the zen-cart license and are unable | 17 // | to obtain it through the world-wide-web, please send a note to | 18 // | license@zen-cart.com so we can mail you a copy immediately. | 19 // +----------------------------------------------------------------------+ 20 // $Id: gv_queue.php 1969 2005-09-13 06:57:21Z drbyte $ 21 // 22 23 require ('includes/application_top.php'); 24 25 require (DIR_WS_CLASSES . 'currencies.php'); 26 $currencies = new currencies(); 27 28 // bof: find gv for a particular order and set page 29 if ($_GET['order'] != '') { 30 $gv_check = $db->Execute("select order_id, unique_id 31 from " . TABLE_COUPON_GV_QUEUE . " 32 where order_id = '" . $_GET['order'] . "' and release_flag= 'N' limit 1"); 33 34 $_GET['gid'] = $gv_check->fields['unique_id']; 35 36 $gv_page = $db->Execute("select c.customers_firstname, c.customers_lastname, gv.unique_id, gv.date_created, gv.amount, gv.order_id from " . TABLE_CUSTOMERS . " c, " . TABLE_COUPON_GV_QUEUE . " gv where (gv.customer_id = c.customers_id and gv.release_flag = 'N')" . " order by gv.order_id, gv.unique_id"); 37 $page_cnt=1; 38 while (!$gv_page->EOF) { 39 if ($gv_page->fields['order_id'] == $_GET['order']) { 40 break; 41 } 42 $page_cnt++; 43 $gv_page->MoveNext(); 44 } 45 $_GET['page'] = round(($page_cnt/MAX_DISPLAY_SEARCH_RESULTS)); 46 zen_redirect(zen_href_link(FILENAME_GV_QUEUE, 'gid=' . $gv_check->fields['unique_id'] . '&page=' . $_GET['page'])); 47 } 48 // eof: find gv for a particular order and set page 49 50 if ($_GET['action'] == 'confirmrelease' && isset($_GET['gid'])) { 51 $gv_result = $db->Execute("select release_flag 52 from " . TABLE_COUPON_GV_QUEUE . " 53 where unique_id='" . $_GET['gid'] . "'"); 54 55 if ($gv_result->fields['release_flag'] == 'N') { 56 $gv_resulta = $db->Execute("select customer_id, amount, order_id 57 from " . TABLE_COUPON_GV_QUEUE . " 58 where unique_id='" . $_GET['gid'] . "'"); 59 60 if ($gv_resulta->RecordCount() > 0) { 61 $gv_amount = $gv_resulta->fields['amount']; 62 63 // Begin composing email content 64 // //Let's build a message object using the email class 65 $mail = $db->Execute("select customers_firstname, customers_lastname, customers_email_address 66 from " . TABLE_CUSTOMERS . " 67 where customers_id = '" . $gv_resulta->fields['customer_id'] . "'"); 68 69 $message = TEXT_REDEEM_GV_MESSAGE_HEADER . "\n" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . "\n\n" . TEXT_REDEEM_GV_MESSAGE_RELEASED; 70 $message .= sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, $currencies->format($gv_amount)) . "\n\n"; 71 $message .= TEXT_REDEEM_GV_MESSAGE_THANKS . "\n" . STORE_OWNER . "\n\n" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG; 72 $message .= TEXT_REDEEM_GV_MESSAGE_BODY; 73 $message .= TEXT_REDEEM_GV_MESSAGE_FOOTER; 74 $message .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; 75 76 $html_msg['EMAIL_FIRST_NAME'] = $mail->fields['customers_firstname']; 77 $html_msg['EMAIL_LAST_NAME'] = $mail->fields['customers_lastname']; 78 $html_msg['GV_NOTICE_HEADER'] = TEXT_REDEEM_GV_MESSAGE_HEADER; 79 $html_msg['GV_NOTICE_RELEASED'] = TEXT_REDEEM_GV_MESSAGE_RELEASED; 80 $html_msg['GV_NOTICE_AMOUNT_REDEEM'] = sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, '<strong>' . $currencies->format($gv_amount) . '</strong>'); 81 $html_msg['GV_NOTICE_VALUE'] = $currencies->format($gv_amount); 82 $html_msg['GV_NOTICE_THANKS'] = TEXT_REDEEM_GV_MESSAGE_THANKS; 83 $html_msg['TEXT_REDEEM_GV_MESSAGE_BODY'] = TEXT_REDEEM_GV_MESSAGE_BODY; 84 $html_msg['TEXT_REDEEM_GV_MESSAGE_FOOTER'] = TEXT_REDEEM_GV_MESSAGE_FOOTER; 85 86 //send the message 87 zen_mail($mail->fields['customers_firstname'] . ' ' . $mail->fields['customers_lastname'], $mail->fields['customers_email_address'], TEXT_REDEEM_GV_SUBJECT . TEXT_REDEEM_GV_SUBJECT_ORDER . $gv_resulta->fields['order_id'] , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'gv_queue'); 88 89 90 91 $gv_amount=$gv_resulta->fields['amount']; 92 $gv_result=$db->Execute("select amount 93 from " . TABLE_COUPON_GV_CUSTOMER . " 94 where customer_id='" . $gv_resulta->fields['customer_id'] . "'"); 95 96 $customer_gv=false; 97 $total_gv_amount=0; 98 if ($gv_result->RecordCount() > 0) { 99 $total_gv_amount=$gv_result->fields['amount']; 100 $customer_gv=true; 101 } 102 $total_gv_amount=$total_gv_amount+$gv_amount; 103 if ($customer_gv) { 104 $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " 105 set amount='" . $total_gv_amount . "' 106 where customer_id='" . $gv_resulta->fields['customer_id'] . "'"); 107 } else { 108 $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " 109 (customer_id, amount) 110 values ('" . $gv_resulta->fields['customer_id']. "', '" . $total_gv_amount . "')"); 111 } 112 $db->Execute("update " . TABLE_COUPON_GV_QUEUE . " 113 set release_flag= 'Y' 114 where unique_id='" . $_GET['gid'] . "'"); 115 } 116 } 117 } 118 ?> 119 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 120 <html <?php echo HTML_PARAMS; ?>> 121 <head> 122 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 123 <title><?php echo TITLE; ?></title> 124 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 125 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 126 <script language="javascript" src="includes/menu.js"></script> 127 <script type="text/javascript"> 128 <!-- 129 function init() 130 { 131 cssjsmenu('navbar'); 132 if (document.getElementById) 133 { 134 var kill = document.getElementById('hoverJS'); 135 kill.disabled = true; 136 } 137 } 138 // --> 139 </script> 140 </head> 141 <body onload="init()"> 142 <!-- header //--> 143 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 144 <!-- header_eof //--> 145 146 <!-- body //--> 147 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 148 <tr> 149 <!-- body_text //--> 150 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 151 <tr> 152 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 153 <tr> 154 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 155 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 156 </tr> 157 </table></td> 158 </tr> 159 <tr> 160 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 161 <tr> 162 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 163 <tr class="dataTableHeadingRow"> 164 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td> 165 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDERS_ID; ?></td> 166 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_VOUCHER_VALUE; ?></td> 167 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td> 168 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 169 </tr> 170 <?php 171 $gv_query_raw = "select c.customers_firstname, c.customers_lastname, gv.unique_id, gv.date_created, gv.amount, gv.order_id from " . TABLE_CUSTOMERS . " c, " . TABLE_COUPON_GV_QUEUE . " gv where (gv.customer_id = c.customers_id and gv.release_flag = 'N')" . " order by gv.order_id, gv.unique_id"; 172 $gv_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $gv_query_raw, $gv_query_numrows); 173 $gv_list = $db->Execute($gv_query_raw); 174 while (!$gv_list->EOF) { 175 if (((!$_GET['gid']) || (@$_GET['gid'] == $gv_list->fields['unique_id'])) && (!$gInfo)) { 176 $gInfo = new objectInfo($gv_list->fields); 177 } 178 if ( (is_object($gInfo)) && ($gv_list->fields['unique_id'] == $gInfo->unique_id) ) { 179 echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . zen_href_link('gv_queue.php', zen_get_all_get_params(array('gid', 'action')) . 'gid=' . $gInfo->unique_id . '&action=edit') . '\'">' . "\n"; 180 } else { 181 echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . zen_href_link('gv_queue.php', zen_get_all_get_params(array('gid', 'action')) . 'gid=' . $gv_list->fields['unique_id']) . '\'">' . "\n"; 182 } 183 ?> 184 <td class="dataTableContent"><?php echo $gv_list->fields['customers_firstname'] . ' ' . $gv_list->fields['customers_lastname']; ?></td> 185 <td class="dataTableContent" align="center"><?php echo $gv_list->fields['order_id']; ?></td> 186 <td class="dataTableContent" align="right"><?php echo $currencies->format($gv_list->fields['amount']); ?></td> 187 <td class="dataTableContent" align="right"><?php echo zen_datetime_short($gv_list->fields['date_created']); ?></td> 188 <td class="dataTableContent" align="right"><?php if ( (is_object($gInfo)) && ($gv_list->fields['unique_id'] == $gInfo->unique_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'page=' . $_GET['page'] . '&gid=' . $gv_list->fields['unique_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> 189 </tr> 190 <?php 191 $gv_list->MoveNext(); 192 } 193 ?> 194 <tr> 195 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 196 <tr> 197 <td class="smallText" valign="top"><?php echo $gv_split->display_count($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_GIFT_VOUCHERS); ?></td> 198 <td class="smallText" align="right"><?php echo $gv_split->display_links($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> 199 </tr> 200 </table></td> 201 </tr> 202 </table></td> 203 <?php 204 $heading = array(); 205 $contents = array(); 206 switch ($_GET['action']) { 207 case 'release': 208 $heading[] = array('text' => '[' . $gInfo->unique_id . '] ' . zen_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount)); 209 210 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link('gv_queue.php', 'action=confirmrelease&gid=' . $gInfo->unique_id,'NONSSL') . '">' . zen_image_button('button_confirm_red.gif', IMAGE_CONFIRM) . '</a> <a href="' . zen_href_link('gv_queue.php', 'action=cancel&gid=' . $gInfo->unique_id,'NONSSL') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 211 break; 212 default: 213 $heading[] = array('text' => '[' . $gInfo->unique_id . '] ' . zen_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount)); 214 215 if ($gv_list->RecordCount() == 0) { 216 $contents[] = array('align' => 'center','text' => TEXT_GV_NONE); 217 } else { 218 $contents[] = array('align' => 'center','text' => '<a href="' . zen_href_link('gv_queue.php','action=release&gid=' . $gInfo->unique_id,'NONSSL'). '">' . zen_image_button('button_release_gift.gif', IMAGE_RELEASE) . '</a>'); 219 220 // quick link to order 221 $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','90%','3')); 222 $contents[] = array('align' => 'center', 'text' => TEXT_EDIT_ORDER . $gInfo->order_id); 223 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, 'oID=' . $gInfo->order_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_order.gif', IMAGE_ORDER) . '</a>'); 224 } 225 break; 226 } 227 228 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 229 echo ' <td width="25%" valign="top">' . "\n"; 230 231 $box = new box; 232 echo $box->infoBox($heading, $contents); 233 234 echo ' </td>' . "\n"; 235 } 236 ?> 237 </tr> 238 </table></td> 239 </tr> 240 </table></td> 241 <!-- body_text_eof //--> 242 </tr> 243 </table> 244 <!-- body_eof //--> 245 246 <!-- footer //--> 247 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 248 <!-- footer_eof //--> 249 <br /> 250 </body> 251 </html> 252 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |