Execute("select order_id, unique_id from " . TABLE_COUPON_GV_QUEUE . " where order_id = '" . $_GET['order'] . "' and release_flag= 'N' limit 1"); $_GET['gid'] = $gv_check->fields['unique_id']; $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"); $page_cnt=1; while (!$gv_page->EOF) { if ($gv_page->fields['order_id'] == $_GET['order']) { break; } $page_cnt++; $gv_page->MoveNext(); } $_GET['page'] = round(($page_cnt/MAX_DISPLAY_SEARCH_RESULTS)); zen_redirect(zen_href_link(FILENAME_GV_QUEUE, 'gid=' . $gv_check->fields['unique_id'] . '&page=' . $_GET['page'])); } // eof: find gv for a particular order and set page if ($_GET['action'] == 'confirmrelease' && isset($_GET['gid'])) { $gv_result = $db->Execute("select release_flag from " . TABLE_COUPON_GV_QUEUE . " where unique_id='" . $_GET['gid'] . "'"); if ($gv_result->fields['release_flag'] == 'N') { $gv_resulta = $db->Execute("select customer_id, amount, order_id from " . TABLE_COUPON_GV_QUEUE . " where unique_id='" . $_GET['gid'] . "'"); if ($gv_resulta->RecordCount() > 0) { $gv_amount = $gv_resulta->fields['amount']; // Begin composing email content // //Let's build a message object using the email class $mail = $db->Execute("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $gv_resulta->fields['customer_id'] . "'"); $message = TEXT_REDEEM_GV_MESSAGE_HEADER . "\n" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . "\n\n" . TEXT_REDEEM_GV_MESSAGE_RELEASED; $message .= sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, $currencies->format($gv_amount)) . "\n\n"; $message .= TEXT_REDEEM_GV_MESSAGE_THANKS . "\n" . STORE_OWNER . "\n\n" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG; $message .= TEXT_REDEEM_GV_MESSAGE_BODY; $message .= TEXT_REDEEM_GV_MESSAGE_FOOTER; $message .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; $html_msg['EMAIL_FIRST_NAME'] = $mail->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $mail->fields['customers_lastname']; $html_msg['GV_NOTICE_HEADER'] = TEXT_REDEEM_GV_MESSAGE_HEADER; $html_msg['GV_NOTICE_RELEASED'] = TEXT_REDEEM_GV_MESSAGE_RELEASED; $html_msg['GV_NOTICE_AMOUNT_REDEEM'] = sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, '' . $currencies->format($gv_amount) . ''); $html_msg['GV_NOTICE_VALUE'] = $currencies->format($gv_amount); $html_msg['GV_NOTICE_THANKS'] = TEXT_REDEEM_GV_MESSAGE_THANKS; $html_msg['TEXT_REDEEM_GV_MESSAGE_BODY'] = TEXT_REDEEM_GV_MESSAGE_BODY; $html_msg['TEXT_REDEEM_GV_MESSAGE_FOOTER'] = TEXT_REDEEM_GV_MESSAGE_FOOTER; //send the message 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'); $gv_amount=$gv_resulta->fields['amount']; $gv_result=$db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id='" . $gv_resulta->fields['customer_id'] . "'"); $customer_gv=false; $total_gv_amount=0; if ($gv_result->RecordCount() > 0) { $total_gv_amount=$gv_result->fields['amount']; $customer_gv=true; } $total_gv_amount=$total_gv_amount+$gv_amount; if ($customer_gv) { $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount='" . $total_gv_amount . "' where customer_id='" . $gv_resulta->fields['customer_id'] . "'"); } else { $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $gv_resulta->fields['customer_id']. "', '" . $total_gv_amount . "')"); } $db->Execute("update " . TABLE_COUPON_GV_QUEUE . " set release_flag= 'Y' where unique_id='" . $_GET['gid'] . "'"); } } } ?> > <?php echo TITLE; ?>
'[' . $gInfo->unique_id . '] ' . zen_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount)); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_confirm_red.gif', IMAGE_CONFIRM) . '' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: $heading[] = array('text' => '[' . $gInfo->unique_id . '] ' . zen_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount)); if ($gv_list->RecordCount() == 0) { $contents[] = array('align' => 'center','text' => TEXT_GV_NONE); } else { $contents[] = array('align' => 'center','text' => '' . zen_image_button('button_release_gift.gif', IMAGE_RELEASE) . ''); // quick link to order $contents[] = array('align' => 'center', 'text' => '
' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','90%','3')); $contents[] = array('align' => 'center', 'text' => TEXT_EDIT_ORDER . $gInfo->order_id); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_order.gif', IMAGE_ORDER) . ''); } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo ' ' . "\n"; } ?>
Execute($gv_query_raw); while (!$gv_list->EOF) { if (((!$_GET['gid']) || (@$_GET['gid'] == $gv_list->fields['unique_id'])) && (!$gInfo)) { $gInfo = new objectInfo($gv_list->fields); } if ( (is_object($gInfo)) && ($gv_list->fields['unique_id'] == $gInfo->unique_id) ) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?> MoveNext(); } ?>
 
fields['customers_firstname'] . ' ' . $gv_list->fields['customers_lastname']; ?> fields['order_id']; ?> format($gv_list->fields['amount']); ?> fields['date_created']); ?> fields['unique_id'] == $gInfo->unique_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> 
display_count($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_GIFT_VOUCHERS); ?> display_links($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '