Ejemplo n.º 1
0
 function _logSuccess($ref)
 {
     web_invoice_update_log($this->invoice->id, 'pp_ipn_success', "Successful PayPal IPN request from {$this->ip}. REF: {$ref}");
 }
Ejemplo n.º 2
0
 function _logSuccess($ref)
 {
     web_invoice_update_log($this->invoice->id, 'google_checkout_api_success', "Successful Google Checkout API request from {$this->ip}. REF: {$ref}");
 }
Ejemplo n.º 3
0
function web_invoice_process_invoice_update($invoice_id, $unprivileged = false)
{
    global $wpdb;
    if ($unprivileged) {
        $profileuser = get_currentuserinfo();
    } else {
        $profileuser = get_userdata($_POST['user_id']);
    }
    $description = $_REQUEST['description'];
    $subject = $_REQUEST['subject'];
    $amount = $_REQUEST['amount'];
    $user_id = $_REQUEST['user_id'];
    $web_invoice_tax = serialize($_REQUEST['web_invoice_tax']);
    $itemized_list = $_REQUEST['itemized_list'];
    $web_invoice_custom_invoice_id = $_REQUEST['web_invoice_custom_invoice_id'];
    $web_invoice_date = "{$_REQUEST['web_invoice_date_year']}-{$_REQUEST['web_invoice_date_month']}-{$_REQUEST['web_invoice_date_day']}";
    $web_invoice_due_date_month = $_REQUEST['web_invoice_due_date_month'];
    $web_invoice_due_date_day = $_REQUEST['web_invoice_due_date_day'];
    $web_invoice_due_date_year = $_REQUEST['web_invoice_due_date_year'];
    $web_invoice_first_name = $_REQUEST['web_invoice_first_name'];
    $web_invoice_last_name = $_REQUEST['web_invoice_last_name'];
    $web_invoice_tax_id = $_REQUEST['web_invoice_tax_id'];
    $web_invoice_company_name = $_REQUEST['web_invoice_company_name'];
    $web_invoice_streetaddress = $_REQUEST['web_invoice_streetaddress'];
    $web_invoice_city = $_REQUEST['web_invoice_city'];
    $web_invoice_state = $_REQUEST['web_invoice_state'];
    $web_invoice_zip = $_REQUEST['web_invoice_zip'];
    $web_invoice_country = $_REQUEST['web_invoice_country'];
    $web_invoice_currency_code = $_REQUEST['web_invoice_currency_code'];
    $web_invoice_subscription_name = $_REQUEST['web_invoice_subscription_name'];
    $web_invoice_subscription_unit = $_REQUEST['web_invoice_subscription_unit'];
    $web_invoice_subscription_length = $_REQUEST['web_invoice_subscription_length'];
    $web_invoice_subscription_start_month = $_REQUEST['web_invoice_subscription_start_month'];
    $web_invoice_subscription_start_day = $_REQUEST['web_invoice_subscription_start_day'];
    $web_invoice_subscription_start_year = $_REQUEST['web_invoice_subscription_start_year'];
    $web_invoice_subscription_total_occurances = $_REQUEST['web_invoice_subscription_total_occurances'];
    $web_invoice_payment_methods = join(',', $_REQUEST['web_invoice_payment_methods']);
    $web_invoice_tax_names = unserialize(get_option('web_invoice_tax_name'));
    if (!is_array($web_invoice_tax_names)) {
        $web_invoice_tax_names = array();
    }
    for ($_txc = 0; $_txc < get_option('web_invoice_tax_count'); $_txc++) {
        if (!isset($_REQUEST['web_invoice_tax_name_' . $_txc])) {
            continue;
        }
        $web_invoice_tax_names[$_txc] = $_REQUEST['web_invoice_tax_name_' . $_txc];
    }
    //remove items from itemized list that are missing a title, they are most likely deleted
    if (is_array($itemized_list)) {
        $counter = 1;
        foreach ($itemized_list as $itemized_item) {
            if (empty($itemized_item[name])) {
                unset($itemized_list[$counter]);
            }
            $counter++;
        }
        array_values($itemized_list);
    }
    $itemized = urlencode(serialize($itemized_list));
    // Check if this is new invoice creation, or an update
    if (web_invoice_does_invoice_exist($invoice_id)) {
        // Updating Old Invoice
        if (web_invoice_get_invoice_attrib($invoice_id, 'subject') != $subject) {
            $wpdb->query("UPDATE " . Web_Invoice::tablename('main') . " SET subject = '{$subject}' WHERE invoice_num = {$invoice_id}");
            web_invoice_update_log($invoice_id, 'updated', ' Subject Updated ');
            $message .= "Subject updated. ";
            web_invoice_clear_cache();
        }
        if (web_invoice_get_invoice_attrib($invoice_id, 'description') != $description) {
            $wpdb->query("UPDATE " . Web_Invoice::tablename('main') . " SET description = '{$description}' WHERE invoice_num = {$invoice_id}");
            web_invoice_update_log($invoice_id, 'updated', ' Description Updated ');
            $message .= "Description updated. ";
            web_invoice_clear_cache();
        }
        if (web_invoice_get_invoice_attrib($invoice_id, 'amount') != $amount) {
            $wpdb->query("UPDATE " . Web_Invoice::tablename('main') . " SET amount = '{$amount}' WHERE invoice_num = {$invoice_id}");
            web_invoice_update_log($invoice_id, 'updated', ' Amount Updated ');
            $message .= "Amount updated. ";
            web_invoice_clear_cache();
        }
        if (web_invoice_get_invoice_attrib($invoice_id, 'invoice_date') != $web_invoice_date) {
            $wpdb->query("UPDATE " . Web_Invoice::tablename('main') . " SET invoice_date = '{$web_invoice_date}' WHERE invoice_num = {$invoice_id}");
            web_invoice_update_log($invoice_id, 'updated', ' Invoice Date Updated ');
            $message .= "Invoice date updated. ";
            web_invoice_clear_cache();
        }
        if (web_invoice_get_invoice_attrib($invoice_id, 'itemized') != $itemized) {
            $wpdb->query("UPDATE " . Web_Invoice::tablename('main') . " SET itemized = '{$itemized}' WHERE invoice_num = {$invoice_id}");
            web_invoice_update_log($invoice_id, 'updated', ' Itemized List Updated ');
            $message .= "Itemized List updated. ";
            web_invoice_clear_cache();
        }
    } else {
        // Create New Invoice
        if ($wpdb->query("INSERT INTO " . Web_Invoice::tablename('main') . " (amount,invoice_date,description,invoice_num,user_id,subject,itemized,status)\tVALUES ('{$amount}','{$web_invoice_date}','{$description}','{$invoice_id}','{$user_id}','{$subject}','{$itemized}','0')")) {
            $message = "New Invoice saved.";
            web_invoice_update_log($invoice_id, 'created', ' Created ');
        } else {
            $error = true;
            $message = "There was a problem saving invoice. Try deactivating and reactivating plugin. REF: " . mysql_errno();
        }
    }
    // See if invoice is recurring
    if (!empty($web_invoice_subscription_name) && !empty($web_invoice_subscription_unit) && !empty($web_invoice_subscription_total_occurances)) {
        $web_invoice_recurring_status = true;
        web_invoice_update_invoice_meta($invoice_id, "web_invoice_recurring_billing", true);
        $message .= " Recurring invoice saved.  This invoice may be viewed under \"Recurring Billing\". ";
    }
    // See if invoice is recurring
    if (empty($web_invoice_subscription_name) && empty($web_invoice_subscription_unit) && empty($web_invoice_subscription_total_occurances)) {
        $web_invoice_recurring_status = false;
        web_invoice_update_invoice_meta($invoice_id, "web_invoice_recurring_billing", false);
    }
    // Update Invoice Meta
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_custom_invoice_id", $web_invoice_custom_invoice_id);
    web_invoice_update_invoice_meta($invoice_id, "tax_value", $web_invoice_tax);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_currency_code", $web_invoice_currency_code);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_due_date_day", $web_invoice_due_date_day);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_due_date_month", $web_invoice_due_date_month);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_due_date_year", $web_invoice_due_date_year);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_payment_methods", $web_invoice_payment_methods);
    // Update Invoice Recurring Meta
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_subscription_name", $web_invoice_subscription_name);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_subscription_unit", $web_invoice_subscription_unit);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_subscription_length", $web_invoice_subscription_length);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_subscription_start_month", $web_invoice_subscription_start_month);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_subscription_start_day", $web_invoice_subscription_start_day);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_subscription_start_year", $web_invoice_subscription_start_year);
    web_invoice_update_invoice_meta($invoice_id, "web_invoice_subscription_total_occurances", $web_invoice_subscription_total_occurances);
    //Update User Information
    if (!empty($web_invoice_first_name)) {
        update_usermeta($user_id, 'first_name', $web_invoice_first_name);
    }
    if (!empty($web_invoice_last_name)) {
        update_usermeta($user_id, 'last_name', $web_invoice_last_name);
    }
    if (!empty($web_invoice_company_name)) {
        update_usermeta($user_id, 'company_name', $web_invoice_company_name);
    }
    if (!empty($web_invoice_tax_id)) {
        update_usermeta($user_id, 'tax_id', $web_invoice_tax_id);
    }
    if (!empty($web_invoice_streetaddress)) {
        update_usermeta($user_id, 'streetaddress', $web_invoice_streetaddress);
    }
    if (!empty($web_invoice_city)) {
        update_usermeta($user_id, 'city', $web_invoice_city);
    }
    if (!empty($web_invoice_state)) {
        update_usermeta($user_id, 'state', $web_invoice_state);
    }
    if (!empty($web_invoice_zip)) {
        update_usermeta($user_id, 'zip', $web_invoice_zip);
    }
    if (!empty($web_invoice_country)) {
        update_usermeta($user_id, 'country', $web_invoice_country);
    }
    if (is_array($web_invoice_tax_names)) {
        update_option('web_invoice_tax_name', serialize($web_invoice_tax_names));
    }
    //If there is a message, append it with the web invoice link
    if ($message && $invoice_id) {
        $invoice_info = new Web_Invoice_GetInfo($invoice_id);
        $message .= " <a href='" . $invoice_info->display('link') . "'>View Web Invoice</a>.";
    }
    if (!$error) {
        return $message;
    }
    if ($error) {
        return "An error occured: {$message}.";
    }
}
Ejemplo n.º 4
0
 function _logSuccess($ref)
 {
     web_invoice_update_log($this->invoice->id, 'payflow_silent_post_success', "Successful PayPal Payflow silent post request from {$this->ip}. REF: {$ref}");
 }
Ejemplo n.º 5
0
 function _logSuccess($ref)
 {
     web_invoice_update_log($this->invoice->id, 'alertpay_api_success', "Successful AlertPay API request from {$this->ip}. REF: {$ref}");
 }
Ejemplo n.º 6
0
function web_invoice_show_paypal_receipt($invoice_id)
{
    $invoice = new Web_Invoice_GetInfo($invoice_id);
    if (isset($_POST['first_name'])) {
        update_usermeta($invoice->recipient('user_id'), 'first_name', $_POST['first_name']);
    }
    if (isset($_POST['last_name'])) {
        update_usermeta($invoice->recipient('user_id'), 'last_name', $_POST['last_name']);
    }
    if (get_option('web_invoice_send_thank_you_email') == 'yes') {
        web_invoice_send_email_receipt($invoice_id);
    }
    web_invoice_paid($invoice_id);
    web_invoice_update_log($invoice_id, 'paid', "PayPal Receipt: (" . $_REQUEST['receipt_id'] . ")");
    if (isset($_REQUEST['payer_email'])) {
        web_invoice_update_log($invoice_id, 'paid', "PayPal payee user email: (" . $_REQUEST['payer_email'] . ")");
    }
    return '<div id="invoice_page" class="clearfix">
	<div id="invoice_overview" class="cleafix">
	<h2 class="invoice_page_subheading">' . sprintf(__('%s, thank you for your payment!', WEB_INVOICE_TRANS_DOMAIN), $invoice->recipient("callsign")) . '</h2>
	<p><strong>' . sprintf(__('Invoice %s has been paid.', WEB_INVOICE_TRANS_DOMAIN), $invoice->display("display_id")) . '</strong></p>
	</div>
	</div>';
}
Ejemplo n.º 7
0
 function _logSuccess($ref)
 {
     web_invoice_update_log($this->invoice->id, '2co_api_success', "Successful 2CO API request from {$this->ip}. REF: {$ref}");
 }
Ejemplo n.º 8
0
 function Web_Invoice_Decider($web_invoice_action = null)
 {
     global $wpdb, $web_invoice_memory_head_room;
     if (26214400 > $web_invoice_memory_head_room) {
         $this->message = sprintf(__("Less than 25MB of memory available for Web Invoice, please set <code>memory_limit = %s</code> in your" . "<code>php.ini</code> if Web Invoice crashes unexpectedly", WEB_INVOICE_TRANS_DOMAIN), web_invoice_return_bytes_nice(web_invoice_return_bytes(ini_get('memory_limit')) + 27000000));
     }
     $web_invoice_action = !empty($_REQUEST['web_invoice_action']) ? $_REQUEST['web_invoice_action'] : $web_invoice_action;
     $invoice_id = $_REQUEST['invoice_id'];
     if (!$invoice_id) {
         $invoice_id = $_REQUEST['multiple_invoices'][0];
     }
     $web_invoice_recurring_billing = web_invoice_meta($invoice_id, 'web_invoice_recurring_billing');
     //echo "do this: " . $web_invoice_action;
     echo "<div class='wrap'>";
     switch ($web_invoice_action) {
         case "save_and_preview":
             if (empty($invoice_id)) {
                 web_invoice_show_message("Error - invoice id was not passed.");
             } else {
                 web_invoice_show_message(web_invoice_process_invoice_update($invoice_id), 'updated fade');
                 if (web_invoice_meta($invoice_id, 'subscription_id') && web_invoice_meta($invoice_id, 'recurring_transaction_id')) {
                     require_once 'gateways/payflowpro.class.php';
                     $pfp = new Web_Invoice_PayflowProRecurring();
                     if (web_invoice_meta($invoice_id, 'web_invoice_recurring_billing')) {
                         $pfp->updateProfile($invoice_id);
                         web_invoice_update_log($invoice_id, 'pfp_subscription_update', "Subscription updated. REF: " . $pfp->getRef());
                     } else {
                         if ($pfp->deleteProfile(web_invoice_meta($invoice_id, 'subscription_id'))) {
                             web_invoice_update_log($invoice_id, 'pfp_subscription_update', "Subscription cancelled. REF: " . $pfp->getRef());
                             web_invoice_update_invoice_meta($invoice_id, 'pfp_status', 'cancelled');
                             web_invoice_delete_invoice_meta($invoice_id, 'subscription_id');
                         }
                     }
                 }
                 web_invoice_saved_preview($invoice_id);
                 do_action('web_invoice_invoice_save', $invoice_id);
             }
             break;
         case "clear_log":
             web_invoice_show_message(web_invoice_clear_invoice_status($invoice_id), 'updated fade');
             web_invoice_options_manageInvoice($invoice_id);
             break;
         case "doPausePfp":
             if (web_invoice_meta($invoice_id, 'subscription_id') && web_invoice_meta($invoice_id, 'recurring_transaction_id')) {
                 require_once 'gateways/payflowpro.class.php';
                 $pfp = new Web_Invoice_PayflowProRecurring();
                 if (web_invoice_meta($invoice_id, 'web_invoice_recurring_billing')) {
                     $profile_id = web_invoice_meta($invoice_id, 'subscription_id');
                     if ($pfp->pauseProfile($profile_id)) {
                         web_invoice_update_log($invoice_id, 'pfp_subscription_update', "Subscription paused. REF: " . $pfp->getRef());
                         web_invoice_update_invoice_meta($invoice_id, 'pfp_status', 'paused');
                         web_invoice_delete_invoice_meta($invoice_id, 'subscription_id');
                         do_action('web_invoice_invoice_pause_recurring', $invoice_id);
                         $message = 'Paused subscription.';
                     } else {
                         $message = 'Failed to pause subscription.';
                     }
                     $message .= " <a href='admin.php?page=new_web_invoice&web_invoice_action=doInvoice&invoice_id=" . $invoice_id . "'>Continue editing</a>";
                     web_invoice_show_message($message, 'updated fade');
                 }
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "doRestartRecurringPfp":
             if (web_invoice_meta($invoice_id, 'recurring_transaction_id')) {
                 require_once 'gateways/payflowpro.class.php';
                 $pfp = new Web_Invoice_PayflowProRecurring();
                 if (web_invoice_meta($invoice_id, 'web_invoice_recurring_billing')) {
                     $profile_id = web_invoice_meta($invoice_id, 'recurring_transaction_id');
                     if ($pfp->reactivateProfile($profile_id, $invoice_id)) {
                         web_invoice_update_log($invoice_id, 'pfp_subscription_update', "Subscription reactivated. REF: " . $pfp->getRef());
                         web_invoice_update_invoice_meta($invoice_id, 'pfp_status', 'active');
                         web_invoice_update_invoice_meta($invoice_id, 'subscription_id', $profile_id);
                         do_action('web_invoice_invoice_restart_recurring', $invoice_id);
                         $message = 'Reactivated subscription.';
                     } else {
                         $message = 'Failed to reactivate subscription.';
                     }
                     $message .= " <a href='admin.php?page=new_web_invoice&web_invoice_action=doInvoice&invoice_id=" . $invoice_id . "'>Continue editing</a>";
                     web_invoice_show_message($message, 'updated fade');
                 }
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "complete_removal":
             web_invoice_complete_removal();
             web_invoice_show_settings();
             break;
         case "doInvoice":
             if (isset($invoice_id)) {
                 web_invoice_options_manageInvoice($invoice_id);
             } else {
                 web_invoice_options_manageInvoice();
             }
             break;
         case "overview":
             web_invoice_default();
             break;
         case "user_overview":
             web_invoice_user_default();
             break;
         case "web_invoice_show_welcome_message":
             web_invoice_show_welcome_message();
             break;
         case "web_invoice_recurring_billing":
             web_invoice_recurring_overview();
             break;
         case "send_now":
             web_invoice_show_message(web_invoice_send_email($invoice_id));
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "first_setup":
             if (isset($_POST['web_invoice_web_invoice_page'])) {
                 update_option('web_invoice_web_invoice_page', $_POST['web_invoice_web_invoice_page']);
             }
             if (isset($_POST['web_invoice_payment_method'])) {
                 update_option('web_invoice_payment_method', join($_POST['web_invoice_payment_method'], ','));
             }
             if (isset($_POST['web_invoice_gateway_username'])) {
                 update_option('web_invoice_gateway_username', $_POST['web_invoice_gateway_username']);
             }
             if (isset($_POST['web_invoice_gateway_tran_key'])) {
                 update_option('web_invoice_gateway_tran_key', $_POST['web_invoice_gateway_tran_key']);
             }
             if (isset($_POST['web_invoice_gateway_merchant_email'])) {
                 update_option('web_invoice_gateway_merchant_email', $_POST['web_invoice_gateway_merchant_email']);
             }
             // PayPal
             if (isset($_POST['web_invoice_paypal_address'])) {
                 update_option('web_invoice_paypal_address', $_POST['web_invoice_paypal_address']);
             }
             if (isset($_POST['web_invoice_paypal_only_button'])) {
                 update_option('web_invoice_paypal_only_button', $_POST['web_invoice_paypal_only_button']);
             }
             if (isset($_POST['web_invoice_paypal_sandbox'])) {
                 update_option('web_invoice_paypal_sandbox', $_POST['web_invoice_paypal_sandbox']);
             }
             // Payflow
             if (isset($_POST['web_invoice_payflow_login'])) {
                 update_option('web_invoice_payflow_login', $_POST['web_invoice_payflow_login']);
             }
             if (isset($_POST['web_invoice_payflow_partner'])) {
                 update_option('web_invoice_payflow_partner', $_POST['web_invoice_payflow_partner']);
             }
             if (isset($_POST['web_invoice_payflow_only_button'])) {
                 update_option('web_invoice_payflow_only_button', $_POST['web_invoice_payflow_only_button']);
             }
             if (isset($_POST['web_invoice_payflow_silent_post'])) {
                 update_option('web_invoice_payflow_silent_post', $_POST['web_invoice_payflow_silent_post']);
             }
             // Other/Bank
             if (isset($_POST['web_invoice_other_details'])) {
                 update_option('web_invoice_other_details', $_POST['web_invoice_other_details']);
             }
             // Moneybookers
             if (isset($_POST['web_invoice_moneybookers_address'])) {
                 update_option('web_invoice_moneybookers_address', $_POST['web_invoice_moneybookers_address']);
             }
             if (isset($_POST['web_invoice_moneybookers_recurring_address'])) {
                 update_option('web_invoice_moneybookers_recurring_address', $_POST['web_invoice_moneybookers_recurring_address']);
             }
             if (isset($_POST['web_invoice_moneybookers_merchant'])) {
                 update_option('web_invoice_moneybookers_merchant', $_POST['web_invoice_moneybookers_merchant']);
             }
             if (isset($_POST['web_invoice_moneybookers_secret'])) {
                 update_option('web_invoice_moneybookers_secret', $_POST['web_invoice_moneybookers_secret']);
             }
             if (isset($_POST['web_invoice_moneybookers_ip'])) {
                 update_option('web_invoice_moneybookers_ip', $_POST['web_invoice_moneybookers_ip']);
             }
             // AlertPay
             if (isset($_POST['web_invoice_alertpay_address'])) {
                 update_option('web_invoice_alertpay_address', $_POST['web_invoice_alertpay_address']);
             }
             if (isset($_POST['web_invoice_alertpay_merchant'])) {
                 update_option('web_invoice_alertpay_merchant', $_POST['web_invoice_alertpay_merchant']);
             }
             if (isset($_POST['web_invoice_alertpay_secret'])) {
                 update_option('web_invoice_alertpay_secret', $_POST['web_invoice_alertpay_secret']);
             }
             web_invoice_options_manageInvoice();
             break;
         case "web_invoice_settings":
             web_invoice_process_settings();
             web_invoice_show_settings();
             break;
         case "web_invoice_email_templates":
             web_invoice_process_email_templates();
             web_invoice_show_email_templates();
             break;
         case "delete_invoice":
             web_invoice_show_message(web_invoice_delete($_REQUEST['multiple_invoices']));
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "send_invoice":
             if (empty($_REQUEST['multiple_invoices'])) {
                 web_invoice_show_message("No invoices selected, nothing sent.");
             } else {
                 web_invoice_show_message(web_invoice_send_email($_REQUEST['multiple_invoices']), 'updated fade');
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "send_reminder":
             if (empty($_REQUEST['multiple_invoices'])) {
                 web_invoice_show_message("No invoices selected, no reminder sent.");
             } else {
                 web_invoice_show_message(web_invoice_send_email($_REQUEST['multiple_invoices'], 'reminder'), 'updated fade');
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "archive_invoice":
             if (empty($_REQUEST['multiple_invoices'])) {
                 web_invoice_show_message("No invoices selected, nothing archived.");
             } else {
                 web_invoice_show_message(web_invoice_archive($_REQUEST['multiple_invoices']), 'updated fade');
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "unarchive_invoice":
             if (empty($_REQUEST['multiple_invoices'])) {
                 web_invoice_show_message("No invoices selected, nothing un-archived.");
             } else {
                 web_invoice_show_message(web_invoice_unarchive($_REQUEST['multiple_invoices']), 'updated fade');
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "mark_as_paid":
             if (empty($_REQUEST['multiple_invoices'])) {
                 web_invoice_show_message("No invoices selected, nothing marked as paid.");
             } else {
                 web_invoice_show_message(web_invoice_mark_as_paid($_REQUEST['multiple_invoices']), 'updated fade');
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "mark_as_sent":
             if (empty($_REQUEST['multiple_invoices'])) {
                 web_invoice_show_message("No invoices selected, nothing marked as sent..");
             } else {
                 web_invoice_show_message(web_invoice_mark_as_sent($_REQUEST['multiple_invoices']), 'updated fade');
             }
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         case "save_not_send":
             // Already saved, this just shows a message
             $web_invoice_custom_invoice_id = web_invoice_meta($invoice_id, 'web_invoice_custom_invoice_id');
             if ($web_invoice_custom_invoice_id) {
                 $message = "Invoice <b>{$web_invoice_custom_invoice_id}</b> saved.";
             } else {
                 $message = "Invoice <b>#" . $invoice_id . "</b> saved.";
             }
             $message .= " <a href=" . web_invoice_build_invoice_link($invoice_id) . ">View Web Invoice</a>";
             web_invoice_show_message($message, ' updated fade');
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
         default:
             if ($web_invoice_recurring_billing) {
                 web_invoice_recurring_overview();
             } else {
                 web_invoice_default();
             }
             break;
     }
     echo "</div>";
 }
Ejemplo n.º 9
0
 function _logSuccess($ref)
 {
     web_invoice_update_log($this->invoice->id, 'mb_api_success', "Successful Moneybookers API request from {$this->ip}. REF: {$ref}");
 }
Ejemplo n.º 10
0
 public function _logSuccess($ref)
 {
     web_invoice_update_log($this->invoice->id, 'sagepay_api_success', "Successful Sage Pay API request from {$this->ip}. REF: {$ref}");
 }
Ejemplo n.º 11
0
function web_invoice_print_pdf()
{
    $ip = $_SERVER['REMOTE_ADDR'];
    // Check to see a proper invoice id is used, or show regular content
    if (!($invoice_id = web_invoice_md5_to_invoice($_GET['invoice_id']))) {
        return $content;
    }
    // Invoice viewed, update log
    web_invoice_update_log($invoice_id, 'visited', "PDF downloaded by {$ip}");
    $dompdf = web_invoice_pdf_get($invoice_id);
    $dompdf->stream("web-invoice-{$invoice_id}.pdf");
    exit(0);
}