?> " class="submit_button" /> <?php } ?> <?php if (function_exists('convert_html2pdf')) { if (!module_invoice::can_i('edit', 'Invoices')) { ?> <input type="button" name="butt_print" id="butt_print" value="<?php echo _l('Print PDF'); ?> " class="submit_button no_permissions" onclick="window.location.href='<?php echo module_invoice::link_public_print($invoice_id); ?> ';" /> <?php } else { ?> <input type="submit" name="butt_print" id="butt_print" value="<?php echo _l('Print PDF'); ?> " class="submit_button" /> <?php } ?> <?php
if (class_exists('module_finance', false) && module_finance::is_plugin_enabled() && module_finance::can_i('view', 'Finance') && module_finance::is_enabled() && is_file('includes/plugin_finance/pages/finance_invoice_edit.php') && module_config::c('invoice_show_finances', 1)) { include 'includes/plugin_finance/pages/finance_invoice_edit.php'; } } // invoice_id check hook_handle_callback('layout_column_half', 'end'); $form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'onclick' => "\$('#form_redirect').val('" . (!$invoice_id && isset($_REQUEST['job_id']) && (int) $_REQUEST['job_id'] > 0 ? module_job::link_open($_REQUEST['job_id']) : module_invoice::link_open(false)) . "');", 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')))); if ((int) $invoice_id) { if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') { $form_actions['elements'][] = array('type' => 'save_button', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Receipt')); } else { $form_actions['elements'][] = array('type' => 'submit', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Invoice')); } if (function_exists('convert_html2pdf')) { if (!module_invoice::can_i('edit', 'Invoices')) { $form_actions['elements'][] = array('type' => 'button', 'class' => 'submit_button no_permissions', 'name' => 'butt_print', 'value' => _l('Print PDF'), 'onclick' => "window.location.href='" . module_invoice::link_public_print($invoice_id) . "';"); } else { $form_actions['elements'][] = array('type' => 'submit', 'class' => 'submit_button', 'name' => 'butt_print', 'value' => _l('Print PDF')); } } } if ((int) $invoice_id && module_invoice::can_i('delete', 'Invoices')) { $form_actions['elements'][] = array('type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')); } $form_actions['elements'][] = array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_invoice::link_open(false) . "';"); echo module_form::generate_form_actions($form_actions); ?> </form>
public static function google_redirect($description, $amount, $user_id, $invoice_payment_id, $invoice_id, $currency_id) { chdir(dirname(__FILE__)); //'includes/plugin_paymethod_google/'); require_once 'library/googlecart.php'; require_once 'library/googleitem.php'; $server_type = self::is_sandbox() ? "sandbox" : ''; $currency = module_config::get_currency($currency_id); self::add_payment_data($invoice_payment_id, 'log', 'Starting payment of ' . $server_type . ' in currency ' . $currency['code']); $cart = new GoogleCart(self::get_merchant_id(), self::get_merchant_key(), $server_type, $currency['code']); $total_count = 1; // Check this URL for more info about the two types of digital Delivery // http://code.google.com/apis/checkout/developer/Google_Checkout_Digital_Delivery.html // Key/URL delivery self::add_payment_data($invoice_payment_id, 'log', 'Adding ' . $total_count . 'x ' . $description . ' (' . $amount . ' ' . $currency['code'] . ')'); $item_1 = new GoogleItem($description, "", $total_count, $amount); // Unit price //$item_1->SetURLDigitalContent(module_invoice::link_receipt($invoice_payment_id), $item_1->SetURLDigitalContent(module_invoice::link_public_print($invoice_id), '', _l("Payment Receipt")); $cart->AddItem($item_1); $private_data = new MerchantPrivateData(array('invoice_id' => $invoice_id, 'amount' => $amount, 'currency_id' => $currency_id, 'invoice_payment_id' => $invoice_payment_id)); $cart->SetMerchantPrivateData($private_data); // Specify <edit-cart-url> $cart->SetEditCartUrl(module_invoice::link_public($invoice_id)); // Specify "Return to xyz" link $cart->SetContinueShoppingUrl(module_invoice::link_public($invoice_id)); // Request buyer's phone number //$cart->SetRequestBuyerPhone(true); // This will do a server-2-server cart post and send an HTTP 302 redirect status // This is the best way to do it if implementing digital delivery // More info http://code.google.com/apis/checkout/developer/index.html#alternate_technique list($status, $error) = $cart->CheckoutServer2Server(); // if i reach this point, something was wrong echo "An error had ocurred: <br />HTTP Status: " . $status . ":"; echo "<br />Error message:<br />"; echo $error; exit; }