예제 #1
0
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!$invoice_safe) {
    die('failed');
}
$search = isset($_REQUEST['search']) && is_array($_REQUEST['search']) ? $_REQUEST['search'] : array();
if (isset($_REQUEST['customer_id'])) {
    $search['customer_id'] = $_REQUEST['customer_id'];
}
$invoices = module_invoice::get_invoices($search);
$all_invoice_ids = array();
foreach ($invoices as $invoice) {
    $all_invoice_ids[] = $invoice['invoice_id'];
}
if (class_exists('module_table_sort', false) && module_table_sort::is_plugin_enabled()) {
    // get full invoice data.
    // todo: only grab data if we're sorting by something
    // that isn't in the default invoice listing.
    module_table_sort::enable_pagination_hook(array('table_id' => 'invoice_list', 'sortable' => array('invoice_number' => array('field' => 'name'), 'invoice_status' => array('field' => 'status'), 'invoice_create_date' => array('field' => 'date_create', 'current' => 2), 'invoice_due_date' => array('field' => 'date_due'), 'invoice_sent_date' => array('field' => 'date_sent'), 'invoice_paid_date' => array('field' => 'date_paid'), 'invoice_customer' => array('field' => 'customer_name'), 'c_invoice_total' => array('field' => 'cached_total'), 'c_invoice_total_due' => array('field' => 'total_amount_due'))));
    if (isset($_REQUEST['table_sort_column']) || isset($_SESSION['_table_sort']) && isset($_SESSION['_table_sort']['invoice_list']) && isset($_SESSION['_table_sort']['invoice_list'][0])) {
        // we're sorting by something!
        reset($invoices);
        $test = current($invoices);
        if ($test && $test['invoice_id']) {
            $column = isset($_REQUEST['table_sort_column']) ? $_REQUEST['table_sort_column'] : $_SESSION['_table_sort']['invoice_list'][0];
            if (isset(module_table_sort::$table_sort_options['sortable'][$column])) {
                $dbcolumn = module_table_sort::$table_sort_options['sortable'][$column]['field'];
                if (!isset($test[$dbcolumn])) {
                    $test = module_invoice::get_invoice($test['invoice_id']);
                    if (isset($test[$dbcolumn])) {