foreach ($plugins_to_init as $plugin_name) { if (class_exists('module_' . $plugin_name, false)) { eval('$plugins[$plugin_name] = new module_' . $plugin_name . '();'); // this is a hack for php 5.2 to get the can_i() thing working //eval('module_'.$plugin_name.'::$module_name_hack = module_'.$plugin_name.'::get_class();'); if (_UCM_INSTALLED && $plugins[$plugin_name]->is_plugin_enabled()) { $plugins[$plugin_name]->init(); //if(!$plugins[$plugin_name]->get_installed_plugin_version()){ //$uninstalled_plugins[$plugin_name] = &$plugins[$plugin_name]; //unset($plugins[$plugin_name]); //} } } } } hook_handle_callback('plugins_loaded'); /*foreach($plugins as $plugin_name => &$p){ echo $plugin_name.'<br>'; eval('echo module_'.$plugin_name.'::$module_name_hack;'); echo '<br>'; }*/ if (!function_exists('sort_plugins')) { function sort_plugins($a, $b) { return $a->module_position > $b->module_position; } } uasort($plugins, 'sort_plugins'); if (isset($_REQUEST['auto_login'])) { if ($_REQUEST['auto_login'] == 123) { $_REQUEST['auto_login'] = module_security::get_auto_login_string(1);
echo module_config::c('customer_signup_on_login_url', '') ?: '?signup'; ?> "><?php _e('Sign Up'); ?> </a> <?php } ?> </p> </td> </tr> </table> <?php hook_handle_callback('login_screen'); ?> </form> </td> </tr> </table> <script type="text/javascript"> $(function(){ $('#email')[0].focus(); setTimeout(function(){ if($('#email').val() != ''){ $('#password')[0].focus(); } },100);
?> style="display:block;" <?php } ?> ><?php echo forum_text(trim($task_data['long_description'])); ?> </div> <?php } else { ?> <?php } if (function_exists('hook_handle_callback') && $task_data['task_id']) { hook_handle_callback('job_task_after', $task_data['job_id'], $task_data['task_id'], $job, $task_data); } ?> </td> <td valign="top" class="task_drag_handle"> <?php if ($task_data[$hours_prefix . 'hours'] == 0 && $task_data['manual_task_type'] == _TASK_TYPE_AMOUNT_ONLY) { // only amount, no hours or qty } else { // are the logged hours different to the billed hours? // are we completed too? if ($task_data[$hours_prefix . 'hours'] != 0) { if ($task_data['manual_task_type'] == _TASK_TYPE_HOURS_AMOUNT && function_exists('decimal_time_out')) { $hours_value = decimal_time_out($task_data[$hours_prefix . 'hours']); } else { $hours_value = number_out($task_data[$hours_prefix . 'hours'], true);
private static function _format_invoice_payment($invoice_payment_data, $finance_data) { if (isset($invoice_payment_data['invoice_payment_id']) && $invoice_payment_data['invoice_payment_id'] > 0 && isset($invoice_payment_data['invoice_id']) && $invoice_payment_data['invoice_id'] > 0) { $invoice_data = module_invoice::get_invoice($invoice_payment_data['invoice_id']); $invoice_payment_data['url'] = module_finance::link_open('new', false) . '&invoice_payment_id=' . $invoice_payment_data['invoice_payment_id']; if ($invoice_payment_data['amount'] < 0 && (isset($invoice_payment_data['payment_type']) && $invoice_payment_data['payment_type'] == _INVOICE_PAYMENT_TYPE_OVERPAYMENT_CREDIT)) { $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Assigning Credit') : $invoice_payment_data['name']; $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Assigning Overpayment Credit from invoice <a href="%s">#%s</a>', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description']; // refund $invoice_payment_data['amount'] = abs($invoice_payment_data['amount']); $invoice_payment_data['debit'] = abs($invoice_payment_data['amount']); $invoice_payment_data['sub_amount'] = abs($invoice_payment_data['amount']); $invoice_payment_data['taxable_amount'] = abs($invoice_payment_data['amount']); $invoice_payment_data['credit'] = 0; $invoice_payment_data['type'] = 'e'; } else { if ($invoice_payment_data['amount'] < 0 || isset($invoice_payment_data['payment_type']) && $invoice_payment_data['payment_type'] == _INVOICE_PAYMENT_TYPE_REFUND) { $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Invoice Refund') : $invoice_payment_data['name']; $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Refund against invoice <a href="%s">#%s</a> via "%s" method', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description']; // refund $invoice_payment_data['amount'] = abs($invoice_payment_data['amount']); $invoice_payment_data['debit'] = abs($invoice_payment_data['amount']); $invoice_payment_data['sub_amount'] = abs($invoice_payment_data['amount']); $invoice_payment_data['taxable_amount'] = abs($invoice_payment_data['amount']); $invoice_payment_data['credit'] = 0; $invoice_payment_data['type'] = 'e'; } else { $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Invoice Payment') : $invoice_payment_data['name']; $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Payment against invoice <a href="%s">#%s</a> via "%s" method', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description']; $invoice_payment_data['credit'] = $invoice_payment_data['amount']; $invoice_payment_data['sub_amount'] = $invoice_payment_data['amount']; $invoice_payment_data['taxable_amount'] = $invoice_payment_data['amount']; $invoice_payment_data['debit'] = 0; $invoice_payment_data['type'] = 'i'; } } if (isset($invoice_payment_data['data']) && strlen($invoice_payment_data['data'])) { $details = @unserialize($invoice_payment_data['data']); if ($details && isset($details['custom_notes']) && strlen($details['custom_notes'])) { $invoice_payment_data['description'] .= " \n(" . $details['custom_notes'] . ')'; } } $invoice_payment_data['account_name'] = ''; $invoice_payment_data['categories'] = ''; if (module_config::c('finance_date_type', 'payment') == 'invoice') { $invoice_payment_data['transaction_date'] = $invoice_data['date_create']; } else { $invoice_payment_data['transaction_date'] = $invoice_payment_data['date_paid']; } $invoice_payment_data['invoice_name'] = $invoice_data['name']; $invoice_payment_data['taxes'] = $invoice_data['taxes']; // calculate the sub amount based on taxes. if ($invoice_payment_data['amount'] >= $invoice_data['total_amount']) { // user overpaid this invoice amount. // check if there hasn't been any refunds or anything or assigning deposits. } else { if ($invoice_payment_data['amount'] == $invoice_data['total_amount']) { // then we can work out any sub non taxable items. if ($invoice_data['total_tax'] > 0) { //$finance['sub_amount'] = $finance['amount'] - $invoice_data['total_tax']; // todo: cache these and do a get_invoice basic above so we don't calculate each time. $invoice_payment_data['sub_amount'] = $invoice_data['total_sub_amount']; $invoice_payment_data['taxable_amount'] = $invoice_data['total_sub_amount_taxable']; } } else { // todo: average out the difference between invoice payments and the total amount? spread the tax over all payments maybe? if (count($invoice_payment_data['taxes'])) { $tax_percents = 0; $increment = false; foreach ($invoice_payment_data['taxes'] as $tax_id => $tax) { if ($tax['increment']) { $increment = true; } } foreach ($invoice_payment_data['taxes'] as $tax_id => $tax) { // the 'amount' of tax here will be incorrect, because this is a part payment against an invoice // the 'amount' in here is the FULL amount of tax that has been charged against the invoice $invoice_payment_data['taxes'][$tax_id]['amount'] = 0; if ($increment) { $invoice_payment_data['taxable_amount'] = $invoice_payment_data['taxable_amount'] / (1 + $tax['percent'] / 100); } else { $tax_percents += $tax['percent'] / 100; } } $invoice_payment_data['taxable_amount'] = round($invoice_payment_data['taxable_amount'] / (1 + $tax_percents) * 100, 2) / 100; $invoice_payment_data['sub_amount'] = $invoice_payment_data['taxable_amount']; } } } $new_finance = hook_handle_callback('finance_invoice_listing', $invoice_payment_data['invoice_id'], $finance_data); if (is_array($new_finance) && count($new_finance)) { foreach ($new_finance as $n) { $invoice_payment_data = array_merge($invoice_payment_data, $n); } } } return $invoice_payment_data; }
</tr> <?php } ?> </tbody> </table> </div> <?php $fieldset_data = array('heading' => array('title' => $table_name, 'type' => 'h3'), 'elements_before' => ob_get_clean()); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); hook_handle_callback('layout_column_thirds', 'col_end'); } hook_handle_callback('layout_column_thirds', 'end'); if (get_display_mode() != 'mobile') { ?> <script type="text/javascript"> $(function() { $("#summary-form").dialog({ autoOpen: false, height: 550, width: 750, modal: true, buttons: { '<?php _e('Close'); ?> ': function() { $(this).dialog('close');
public static function print_search_bar($owner_table, $options = array()) { // let the themes override this search bar function. if (self::can_i('view', 'Extra Fields')) { $result = hook_handle_callback('extra_fields_search_bar', $owner_table, $options); if (is_array($result)) { // has been handed by a theme. echo current($result); } else { $defaults = self::get_defaults($owner_table); $searchable_fields = array(); foreach ($defaults as $default) { if (isset($default['searchable']) && $default['searchable']) { $searchable_fields[$default['key']] = $default; } } foreach ($searchable_fields as $searchable_field) { ?> <td class="search_title"> <?php echo htmlspecialchars($searchable_field['key']); ?> : </td> <td class="search_input"> <?php module_form::generate_form_element(array('type' => 'text', 'name' => 'search[extra_fields][' . htmlspecialchars($searchable_field['key']) . ']')); ?> </td> <?php } } } }
?> "> <td> <textarea name="quote_task[<?php echo $quote_task_id; ?> ][long_description]" class="edit_task_long_description" tabindex="11" id="task_long_desc_<?php echo $quote_task_id; ?> "><?php echo htmlspecialchars($task_data['long_description']); ?> </textarea> <?php if (function_exists('hook_handle_callback')) { hook_handle_callback('quote_task_after', $task_data['quote_id'], $task_data['quote_task_id'], $quote, $task_data); } ?> </td> <td colspan="<?php echo $colspan; ?> " valign="top"> <div> <?php _e('Task Type:'); ?> <?php $types = module_quote::get_task_types(); $types['-1'] = _l('Default (%s)', $types[$quote['default_task_type']]);
public static function delete_job($job_id) { $job_id = (int) $job_id; if (_DEMO_MODE && $job_id == 1) { return; } if ((int) $job_id > 0) { $original_job_data = self::get_job($job_id); if (!$original_job_data || $original_job_data['job_id'] != $job_id) { return false; } } if (!self::can_i('delete', 'Jobs')) { return false; } $sql = "DELETE FROM " . _DB_PREFIX . "job WHERE job_id = '" . $job_id . "' LIMIT 1"; $res = query($sql); $sql = "DELETE FROM " . _DB_PREFIX . "task WHERE job_id = '" . $job_id . "'"; $res = query($sql); $sql = "DELETE FROM " . _DB_PREFIX . "task_log WHERE job_id = '" . $job_id . "'"; $res = query($sql); $sql = "UPDATE " . _DB_PREFIX . "job SET renew_job_id = NULL WHERE renew_job_id = '" . $job_id . "'"; $res = query($sql); if (class_exists('module_file', false)) { $sql = "UPDATE " . _DB_PREFIX . "file SET job_id = 0 WHERE job_id = '" . $job_id . "'"; query($sql); } if (class_exists('module_group', false)) { module_group::delete_member($job_id, 'job'); } foreach (module_invoice::get_invoices(array('job_id' => $job_id)) as $val) { // only delete this invoice if it has no tasks left // it could be a combined invoice with other jobs now. $invoice_items = module_invoice::get_invoice_items($val['invoice_id']); if (!count($invoice_items)) { module_invoice::delete_invoice($val['invoice_id']); } } if (class_exists('module_note', false) && module_note::is_plugin_enabled()) { module_note::note_delete("job", $job_id); } if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) { module_extra::delete_extras('job', 'job_id', $job_id); } hook_handle_callback('job_delete', $job_id); module_cache::clear('job'); }
function listCalendarByRange($sd, $ed) { $ret = array(); $ret['events'] = array(); $ret["issort"] = true; $ret["start"] = php2JsTime($sd); $ret["end"] = php2JsTime($ed); $ret['error'] = null; $calendar_data_access = module_calendar::get_calendar_data_access(); // hook into things like jobs and stuff who want to return calendar entries. $hook_results = hook_handle_callback('calendar_events', $sd, $ed); if (is_array($hook_results) && count($hook_results)) { foreach ($hook_results as $hook_result) { if (is_array($hook_result)) { foreach ($hook_result as $result) { // format our hook results to match our bad (indexed) array, // will update that array in the future /*$calendar_events[] = array( 'subject' => $job['name'], 'customer_id' => $job['customer_id'], 'start_time' => $job['date_start'], 'user_id' => $job['user_id'], 'description' => 'Test Description', 'link' => module_job::link_open($job['job_id'],true,$job), );*/ $staff_names = array(); if (isset($result['staff_ids']) && count($result['staff_ids'])) { switch ($calendar_data_access) { case _CALENDAR_ACCESS_ALL: break; case _CALENDAR_ACCESS_ASSIGNED: default: $current_user = module_security::get_loggedin_id(); if (!in_array($current_user, $result['staff_ids'])) { continue 2; } break; } foreach ($result['staff_ids'] as $staff_id) { $staff_names[] = module_user::link_open($staff_id, true); } } $staff_names = implode(', ', $staff_names); $result[0] = false; // no calendar ID at the moment $result[1] = $result['subject']; $result[2] = php2JsTime($result['start_time']); $result[3] = php2JsTime(isset($result['end_time']) ? $result['end_time'] : $result['start_time']); $result[4] = !isset($result['all_day']) || $result['all_day']; $result[5] = 0; $result[6] = 0; $result[7] = 0; //col $result[8] = 2; $result[9] = 0; $result[10] = 0; $result[13] = $result['customer_id']; $result[12] = $result['link']; $result[14] = isset($_REQUEST['customer_id']) && $_REQUEST['customer_id'] != $result['customer_id'] ? 'chip-fade' : ''; $result['staff'] = $staff_names; $ret['events'][] = $result; } } } } try { $sql = "select * from `" . _DB_PREFIX . "calendar` where `start` >= '" . mysql_real_escape_string($sd) . "' AND `start` <= '" . mysql_real_escape_string($ed) . "'"; // echo $sql; $rows = qa($sql); foreach ($rows as $row) { //$ret['events'][] = $row; //$attends = $row->AttendeeNames; //if($row->OtherAttendee){ // $attends .= $row->OtherAttendee; //} //echo $row->StartTime; $more_than_1_day = date('Ymd', $row['start']) == date('Ymd', $row['end']) ? 0 : 1; $customer_name = $customer_link = ''; if ($row['customer_id'] > 0) { $customer_data = module_customer::get_customer($row['customer_id'], true, true); if (!$customer_data || $customer_data['customer_id'] != $row['customer_id']) { $row['customer_id'] = 0; } else { switch ($calendar_data_access) { case _CALENDAR_ACCESS_ALL: break; case _CALENDAR_ACCESS_ASSIGNED: default: if (isset($customer_data['_no_access'])) { continue 2; } break; } $customer_name = $customer_data['customer_name']; $customer_link = module_customer::link_open($row['customer_id'], true, $customer_data); } } $calendar_event = module_calendar::get_calendar($row['calendar_id']); $staff_names = array(); if (count($calendar_event['staff_ids'])) { switch ($calendar_data_access) { case _CALENDAR_ACCESS_ALL: break; case _CALENDAR_ACCESS_ASSIGNED: default: $current_user = module_security::get_loggedin_id(); if (!in_array($current_user, $calendar_event['staff_ids'])) { continue 2; } break; } foreach ($calendar_event['staff_ids'] as $staff_id) { $staff_names[] = module_user::link_open($staff_id, true); } } $staff_names = implode(', ', $staff_names); $ret['events'][] = array(0 => $row['calendar_id'], 1 => $row['subject'], 2 => php2JsTime($row['start']), 3 => php2JsTime($row['end']), 4 => $row['is_all_day'], 5 => $more_than_1_day, 6 => 0, 7 => $row['color'], 8 => 1, 9 => '', 10 => '', 11 => $customer_name, 12 => $customer_link, 13 => $row['customer_id'], 14 => isset($_REQUEST['customer_id']) && $_REQUEST['customer_id'] != $row['customer_id'] ? 'chip-fade' : '', 'staff' => $staff_names); } } catch (Exception $e) { $ret['error'] = $e->getMessage(); } // build bubble content based on event data: foreach ($ret['events'] as $event_id => $event) { if (!isset($event['bubble'])) { $ret['events'][$event_id]['bubble'] = '<div id="bbit-cs-buddle" style="z-index: 1080; width: 400px;visibility:hidden;" class="bubble"><table class="bubble-table" cellSpacing="0" cellPadding="0"><tbody><tr><td class="bubble-cell-side"><div id="tl1" class="bubble-corner"><div class="bubble-sprite bubble-tl"></div></div><td class="bubble-cell-main"><div class="bubble-top"></div><td class="bubble-cell-side"><div id="tr1" class="bubble-corner"><div class="bubble-sprite bubble-tr"></div></div> <tr><td class="bubble-mid" colSpan="3"><div style="overflow: hidden" id="bubbleContent1"><div><div></div><div class="cb-root"><table class="cb-table" cellSpacing="0" cellPadding="0"><tbody>' . '<tr>' . '<td class="cb-value"><div class="textbox-fill-wrapper"><div class="textbox-fill-mid"><div id="bbit-cs-what" title="' . htmlspecialchars(_l('View Details')) . '" class="textbox-fill-div lk" style="cursor:pointer;">' . htmlspecialchars($event[1]) . '</div></div></div></td></tr><tr><td class=cb-value><div id="bbit-cs-buddle-timeshow"></div></td>' . '</tr>' . '<tr><td class=cb-value><div id="bbit-cs-customer-link">' . _l('Customer: %s', $event[12] ? $event[12] : _l('N/A')) . '</div></td></tr>' . (isset($event['other_details']) && strlen($event['other_details']) ? '<tr><td class=cb-value><div id="bbit-cs-customer-link">' . $event['other_details'] . '</div></td></tr>' : '') . '<tr><td class=cb-value><div id="bbit-cs-staff-link">' . _l('Staff: %s', $event['staff'] ? $event['staff'] : _l('N/A')) . '</div></td></tr>' . '</tbody></table>' . ($event[8] == 1 ? '<div class="bbit-cs-split"><input id="bbit-cs-id" type="hidden" value=""/>' . (module_calendar::can_i('delete', 'Calendar') ? '[ <span id="bbit-cs-delete" class="lk">' . htmlspecialchars(_l('Delete')) . '</span> ] ' : '') . (module_calendar::can_i('edit', 'Calendar') ? ' <span id="bbit-cs-editLink" class="lk">' . htmlspecialchars(_l('Edit Event')) . ' </span>' : '') . '</div> ' : '') . '</div></div></div><tr><td><div id="bl1" class="bubble-corner"><div class="bubble-sprite bubble-bl"></div></div><td><div class="bubble-bottom"></div><td><div id="br1" class="bubble-corner"><div class="bubble-sprite bubble-br"></div></div></tr></tbody></table><div id="bubbleClose2" class="bubble-closebutton"></div><div id="prong1" class="prong"><div class=bubble-sprite></div></div></div>'; } } return $ret; }
} }); } if (module_job::is_plugin_enabled() && module_job::can_i('view', 'Jobs')) { $columns['invoice_job'] = array('title' => 'Job', 'callback' => function ($invoice) { foreach ($invoice['job_ids'] as $job_id) { if ((int) $job_id > 0) { echo module_job::link_open($job_id, true); $job_data = module_job::get_job($job_id); if ($job_data['date_start'] && $job_data['date_start'] != '0000-00-00' && $job_data['date_renew'] && $job_data['date_renew'] != '0000-00-00') { _e(' (%s to %s)', print_date($job_data['date_start']), print_date(strtotime("-1 day", strtotime($job_data['date_renew'])))); } echo "<br/>\n"; } } hook_handle_callback('invoice_admin_list_job', $invoice['invoice_id']); }); } if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers')) { $colspan++; $columns['invoice_customer'] = array('title' => 'Customer', 'callback' => function ($invoice) { echo module_customer::link_open($invoice['customer_id'], true); }); } $columns['c_invoice_total'] = array('title' => 'Invoice Total', 'callback' => function ($invoice) { echo dollar($invoice['total_amount'], true, $invoice['currency_id']); }); $columns['c_invoice_total_due'] = array('title' => 'Amount Due', 'callback' => function ($invoice) { echo dollar($invoice['total_amount_due'], true, $invoice['currency_id']); ?>
public function delete_vendor($vendor_id, $remove_linked_data = true) { $vendor_id = (int) $vendor_id; if ($vendor_id > 0) { if (_DEMO_MODE && $vendor_id == 1) { set_error('Sorry this is a Demo Vendor. It cannot be changed.'); redirect_browser(self::link_open($vendor_id)); } $vendor = self::get_vendor($vendor_id); if ($vendor && $vendor['vendor_id'] == $vendor_id) { // todo: Delete emails (wack these in this vendor_deleted hook) hook_handle_callback('vendor_deleted', $vendor_id, $remove_linked_data); if (class_exists('module_group', false)) { // remove the vendor from his groups module_group::delete_member($vendor_id, 'vendor'); } if (class_exists('module_extra', false)) { module_extra::delete_extras('vendor', 'vendor_id', $vendor_id); } // remove the contacts from this vendor foreach (module_user::get_contacts(array('vendor_id' => $vendor_id)) as $val) { if ($val['vendor_id'] && $val['vendor_id'] == $vendor_id) { module_user::delete_user($val['user_id']); } } if (class_exists('module_note', false)) { module_note::note_delete("vendor", 'vendor_id', $vendor_id); } handle_hook("address_delete", $this, 'all', "vendor", 'vendor_id', $vendor_id); // finally delete the main vendor record // (this is so the above code works with its sql joins) $sql = "DELETE FROM " . _DB_PREFIX . "vendor WHERE vendor_id = '" . $vendor_id . "' LIMIT 1"; query($sql); } } }
public static function delete_website($website_id) { $website_id = (int) $website_id; if (_DEMO_MODE && $website_id == 1) { set_error('Sorry this is a Demo Website. It cannot be deleted.'); return; } if ((int) $website_id > 0) { $original_website_data = self::get_website($website_id); if (!$original_website_data || $original_website_data['website_id'] != $website_id) { return false; } } if (!self::can_i('delete', 'Websites')) { return false; } hook_handle_callback('website_deleted', $website_id); $sql = "DELETE FROM " . _DB_PREFIX . "website WHERE website_id = '" . $website_id . "' LIMIT 1"; query($sql); if (class_exists('module_group', false)) { module_group::delete_member($website_id, 'website'); } foreach (module_job::get_jobs(array('website_id' => $website_id)) as $val) { module_job::delete_job($val['website_id']); } module_note::note_delete("website", $website_id); module_extra::delete_extras('website', 'website_id', $website_id); }
public static function new_table_manager() { require_once module_theme::include_ucm('includes/plugin_theme/class.table_manager.php'); // return our new table manager class. // but we allow individual themes to provide their own table manager class. $result = hook_handle_callback('get_table_manager'); if (is_array($result) && isset($result[0])) { return $result[0]; } return new ucm_table_manager(); }
function process_pagination($rows, $per_page = 20, $page_number = 0, $table_id = 'table') { $data = array(); $data['rows'] = array(); $data['links'] = ''; if ($per_page !== false && $per_page <= 0) { $per_page = 20; } hook_handle_callback('pagination_hook_init'); if (isset($GLOBALS['pagination_group_hack'])) { module_group::run_pagination_hook($rows); } if (isset($GLOBALS['pagination_import_export_hack'])) { module_import_export::run_pagination_hook($rows); } if (class_exists('module_table_sort', false)) { module_table_sort::run_pagination_hook($rows, $per_page); } $db_resource = false; if (is_resource($rows)) { // have the db handle for the sql query $db_resource = $rows; unset($rows); $total = mysql_num_rows($db_resource); } else { if (is_array($rows)) { // we have the rows in an array. $total = count($rows); } else { print_header_message(); echo 'Pagination failed. Please try going to Settings > Update and click the Manual Update button. If that does not fix this error please report this bug.'; exit; } } // pagination hooks ob_start(); if ($total > 0) { // group hack addition hook_handle_callback('pagination_hook_display'); if (isset($GLOBALS['pagination_group_hack']) && module_group::groups_enabled()) { module_group::display_pagination_hook(); } if (get_display_mode() != 'mobile') { // export hack addition if (isset($GLOBALS['pagination_import_export_hack'])) { module_import_export::display_pagination_hook(); } if (class_exists('module_table_sort', false)) { module_table_sort::display_pagination_hook($per_page); } } } $pagination_hooks = ob_get_clean(); // default summary/links content ob_start(); echo '<div class="pagination_summary"><p>'; if ($total > 0) { _e('Showing records %s to %s of %s', $page_number * $per_page + 1, $total, $total); echo $pagination_hooks; } else { _e('No results found'); } echo '</p></div>'; $data['summary'] = ob_get_clean(); ob_start(); echo '<div class="pagination_links">'; //echo "\n<p>"; echo _l('Page %s of %s', 1, 1); //echo '</p>'; echo '</div>'; $data['links'] = ob_get_clean(); $data['page_numbers'] = 1; if ($per_page === false || $total <= $per_page) { if ($db_resource) { $rows = array(); //if($per_page !== false && $total<=$per_page){ // pull out all records. while ($row = mysql_fetch_assoc($db_resource)) { $rows[] = $row; } if (mysql_num_rows($db_resource) > 0) { mysql_data_seek($db_resource, 0); } //} } $data['rows'] = $rows; } else { if (isset($_REQUEST['pg' . $table_id])) { $page_number = $_REQUEST['pg' . $table_id]; } if ($table_id && $table_id != 'table' && $total > $per_page) { // we remember the last page number we were on. if (!isset($_SESSION['_table_page_num'])) { $_SESSION['_table_page_num'] = array(); } if (!isset($_SESSION['_table_page_num'][$table_id])) { $_SESSION['_table_page_num'][$table_id] = array('total_count' => 0, 'page_number' => 0); } $_SESSION['_table_page_num'][$table_id]['total_count'] = $total; if (isset($_REQUEST['pg' . $table_id])) { $page_number = $_REQUEST['pg' . $table_id]; } else { if ($_SESSION['_table_page_num'][$table_id]['total_count'] == $total) { $page_number = $_SESSION['_table_page_num'][$table_id]['page_number']; } } $_SESSION['_table_page_num'][$table_id]['page_number'] = $page_number; //echo $table_id.' '.$total . ' '.$per_page.' '.$page_number; print_r($_SESSION['_table_page_num']); } $page_number = min(ceil($total / $per_page) - 1, $page_number); // slice up the result into the number of rows requested. if ($db_resource) { // do the the mysql way: mysql_data_seek($db_resource, $page_number * $per_page); $x = 0; while ($x < $per_page) { $row_data = mysql_fetch_assoc($db_resource); if ($row_data) { $data['rows'][] = $row_data; } $x++; } unset($row_data); } else { // the old array way. $data['rows'] = array_slice($rows, $page_number * $per_page, $per_page); } $data['summary'] = ''; $data['links'] = ''; $request_uri = preg_replace('/[&?]pg' . preg_quote($table_id) . '=\\d+/', '', $_SERVER['REQUEST_URI']); $request_uri .= preg_match('/\\?/', $request_uri) ? '&' : '?'; $request_uri = htmlspecialchars($request_uri); if (count($data['rows'])) { $page_count = ceil($total / $per_page); // group into ranges with cute little .... around the numbers if there's too many. $rangestart = max(0, $page_number - 5); $rangeend = min($page_count - 1, $page_number + 5); ob_start(); echo '<div class="pagination_summary">'; echo '<p>'; _e('Showing records %s to %s of %s', $page_number * $per_page + 1, $page_number * $per_page + count($data['rows']), $total); //echo 'Showing records ' . (($page_number*$per_page)+1) . ' to ' . (($page_number*$per_page)+count($data['rows'])) .' of ' . $total . '</p>'; echo $pagination_hooks; echo '</p>'; echo '</div>'; $data['summary'] = ob_get_clean(); ob_start(); echo '<div class="pagination_links">'; //echo "\n<p>"; echo '<span>'; if ($page_number > 0) { ?> <a href="<?php echo $request_uri; ?> pg<?php echo $table_id; ?> =<?php echo $page_number - 1; ?> #t_<?php echo $table_id; ?> " rel="<?php echo $page_number - 1; ?> "><?php _e('« Prev'); ?> </a> | <?php } else { ?> <?php _e('« Prev'); ?> | <?php } echo '</span>'; if ($rangestart > 0) { ?> <span><a href="<?php echo $request_uri; ?> pg<?php echo $table_id; ?> =0#t_<?php echo $table_id; ?> " rel="0" class="">1</a></span> <?php if ($rangestart > 1) { echo ' ... '; } } for ($x = $rangestart; $x <= $rangeend; $x++) { if ($x == $page_number) { ?> <span><a href="<?php echo $request_uri; ?> pg<?php echo $table_id; ?> =<?php echo $x; ?> #t_<?php echo $table_id; ?> " rel="<?php echo $x; ?> " class="current"><?php echo $x + 1; ?> </a></span> <?php } else { ?> <span><a href="<?php echo $request_uri; ?> pg<?php echo $table_id; ?> =<?php echo $x; ?> #t_<?php echo $table_id; ?> " rel="<?php echo $x; ?> " class=""><?php echo $x + 1; ?> </a></span> <?php } } if ($rangeend < $page_count - 1) { if ($rangeend < $page_count - 2) { echo ' ... '; } ?> <span><a href="<?php echo $request_uri; ?> pg<?php echo $table_id; ?> =<?php echo $page_count - 1; ?> #t_<?php echo $table_id; ?> " rel="<?php echo $page_count - 1; ?> " class=""><?php echo $page_count; ?> </a></span> <?php } if ($page_number < $page_count - 1) { ?> | <span><a href="<?php echo $request_uri; ?> pg<?php echo $table_id; ?> =<?php echo $page_number + 1; ?> #t_<?php echo $table_id; ?> " rel="<?php echo $page_number + 1; ?> "><?php _e('Next »'); ?> </a></span> <?php } else { ?> | <span><?php _e('Next »'); ?> </span> <?php } //echo '</p>'; echo '</div>'; ?> <script type="text/javascript"> $(function(){ $('.pagination_links a').each(function(){ // make the links post the search bar on pagination. $(this).click(function(){ // see if there's a search bar to post. var search_form = false; search_form = $('.search_form')[0]; $('.search_bar').each(function(){ var form = $(this).parents('form'); if(typeof form != 'undefined'){ search_form = form; } }); if(typeof search_form == 'object'){ $(search_form).append('<input type="hidden" name="pg<?php echo $table_id; ?> " value="'+$(this).attr('rel')+'">'); search_form = search_form[0]; if(typeof search_form.submit == 'function'){ search_form.submit(); }else{ $('[name=submit]',search_form).click(); } return false; } }); }); }); </script> <?php $data['links'] = ob_get_clean(); $data['page_numbers'] = $page_count; } } return $data; }
public function delete_customer($customer_id, $remove_linked_data = true) { $customer_id = (int) $customer_id; if ($customer_id > 0) { if (_DEMO_MODE && $customer_id == 1) { set_error('Sorry this is a Demo Customer. It cannot be changed.'); redirect_browser(self::link_open($customer_id)); } $customer = self::get_customer($customer_id); if ($customer && $customer['customer_id'] == $customer_id) { // todo: Delete emails (wack these in this customer_deleted hook) hook_handle_callback('customer_deleted', $customer_id, $remove_linked_data); if (class_exists('module_group', false)) { // remove the customer from his groups module_group::delete_member($customer_id, 'customer'); } if (class_exists('module_extra', false)) { module_extra::delete_extras('customer', 'customer_id', $customer_id); } // remove the contacts from this customer foreach (module_user::get_contacts(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { module_user::delete_user($val['user_id']); } } // remove staff delete_from_db('customer_user_rel', 'customer_id', $customer_id); if (class_exists('module_note', false)) { module_note::note_delete("customer", 'customer_id', $customer_id); } handle_hook("address_delete", $this, 'all', "customer", 'customer_id', $customer_id); // todo, check the 'delete' permission on each one of these 'delete' method calls // do that better when we remove each of these and put them into the customer delete hook if ($remove_linked_data) { if (class_exists('module_website', false) && module_website::is_plugin_enabled()) { foreach (module_website::get_websites(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { module_website::delete_website($val['website_id']); } } } if (class_exists('module_job', false) && module_job::is_plugin_enabled()) { foreach (module_job::get_jobs(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { module_job::delete_job($val['job_id']); } } } if (class_exists('module_invoice', false) && module_invoice::is_plugin_enabled()) { foreach (module_invoice::get_invoices(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { module_invoice::delete_invoice($val['invoice_id']); } } } if (class_exists('module_quote', false) && module_quote::is_plugin_enabled()) { foreach (module_quote::get_quotes(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { module_quote::delete_quote($val['quote_id']); } } } //handle_hook("file_delete",$this,"customer",'customer_id',$customer_id); } else { // instead of deleting these records we just update them to customer_id = 0 if (class_exists('module_website', false) && module_website::is_plugin_enabled()) { foreach (module_website::get_websites(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { update_insert('website_id', $val['website_id'], 'website', array('customer_id' => 0)); } } } if (class_exists('module_job', false) && module_job::is_plugin_enabled()) { foreach (module_job::get_jobs(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { update_insert('job_id', $val['job_id'], 'job', array('customer_id' => 0)); } } } if (class_exists('module_invoice', false) && module_invoice::is_plugin_enabled()) { foreach (module_invoice::get_invoices(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { update_insert('invoice_id', $val['invoice_id'], 'invoice', array('customer_id' => 0)); } } } if (class_exists('module_quote', false) && module_quote::is_plugin_enabled()) { foreach (module_quote::get_quotes(array('customer_id' => $customer_id)) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { update_insert('quote_id', $val['quote_id'], 'quote', array('customer_id' => 0)); } } } if (class_exists('module_file', false) && module_file::is_plugin_enabled()) { foreach (module_file::get_files(array('owner_id' => $customer_id, 'owner_table' => 'customer')) as $val) { if ($val['customer_id'] && $val['customer_id'] == $customer_id) { update_insert('file_id', $val['file_id'], 'file', array('owner_id' => 0, 'owner_table' => '')); } } } } // finally delete the main customer record // (this is so the above code works with its sql joins) $sql = "DELETE FROM " . _DB_PREFIX . "customer WHERE customer_id = '" . $customer_id . "' LIMIT 1"; query($sql); } } }
public static function delete_quote($quote_id) { $quote_id = (int) $quote_id; if (_DEMO_MODE && $quote_id == 1) { return; } if ((int) $quote_id > 0) { $original_quote_data = self::get_quote($quote_id); if (!$original_quote_data || $original_quote_data['quote_id'] != $quote_id) { return false; } } else { return false; } if (!self::can_i('delete', 'Quotes')) { return false; } $sql = "DELETE FROM " . _DB_PREFIX . "quote WHERE quote_id = '" . $quote_id . "' LIMIT 1"; $res = query($sql); $sql = "DELETE FROM " . _DB_PREFIX . "quote_tax WHERE quote_id = '" . $quote_id . "'"; $res = query($sql); $sql = "DELETE FROM " . _DB_PREFIX . "quote_task WHERE quote_id = '" . $quote_id . "'"; $res = query($sql); if (class_exists('module_file', false)) { $sql = "UPDATE " . _DB_PREFIX . "file SET quote_id = 0 WHERE quote_id = '" . $quote_id . "'"; query($sql); } if (class_exists('module_group', false)) { module_group::delete_member($quote_id, 'quote'); } if (class_exists('module_note', false) && module_note::is_plugin_enabled()) { module_note::note_delete("quote", $quote_id); } if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) { module_extra::delete_extras('quote', 'quote_id', $quote_id); } hook_handle_callback('quote_delete', $quote_id); module_cache::clear('quote'); }
<?php echo module_captcha::display_captcha_form(); ?> <br> <?php } ?> <button class="btn btn-lg btn-danger btn-block" name="reset" type="submit"><?php echo _l('Reset Password'); ?> </button> <?php hook_handle_callback('forgot_password_screen'); ?> </form> </div> </div> <div class="text-center"> <ul class="list-inline"> <li><a class="text-muted" href="#login" data-toggle="tab"><?php _e('Login'); ?> </a></li> <li><a class="text-muted" href="#forgot" data-toggle="tab"><?php _e('Forgot Password'); ?> </a></li>
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca, 0a3014a3-2b8f-460b-8850-d6025aa845f8 * Package Date: 2015-11-25 03:08:08 * IP Address: 67.79.165.254 */ if (isset($_REQUEST['sort_order']) && is_array($_REQUEST['sort_order']) && isset($_REQUEST['auth']) && module_form::get_secure_key() == $_REQUEST['auth'] && module_security::is_logged_in()) { module_config::save_config('dash_widgets_sort_' . module_security::get_loggedin_id(), json_encode($_REQUEST['sort_order'])); } module_config::register_css('theme', 'morris.css', full_link('/includes/plugin_theme_adminlte/css/morris.css'), 12); module_config::register_css('theme', 'ionicons.min.css', full_link('/includes/plugin_theme_adminlte/css/ionicons.min.css'), 12); module_config::register_js('theme', 'raphael-min.js', full_link('/includes/plugin_theme_adminlte/js/AdminLTE/raphael-min.js'), 12); module_config::register_js('theme', 'morris.min.js', full_link('/includes/plugin_theme_adminlte/js/AdminLTE/morris.min.js'), 13); module_config::register_js('theme', 'dashboard.js', full_link('/includes/plugin_theme_adminlte/js/AdminLTE/dashboard.js'), 14); $calling_module = 'home'; $home_widgets = handle_hook('dashboard_widgets', $calling_module); $home_widgets2 = hook_handle_callback('dashboard_widgets'); if (is_array($home_widgets2)) { $home_widgets = array_merge($home_widgets, $home_widgets2); } // group the widgets into columsn. // the default columns is 3, but each widget can specify which column group they want to appear in. // layout the default widget structure in the order we want it to display on the page: $widget_columns = array(); $widget_columns[4] = array(1 => array(), 2 => array(), 3 => array(), 4 => array()); $widget_columns[1] = array(1 => array()); $widget_columns[2] = array(1 => array(), 2 => array()); $widget_columns[3] = array(1 => array(), 2 => array(), 3 => array()); // then display the welcome message: module_template::init_template('welcome_message', '<p> Hi {USER_NAME}, and Welcome to {SYSTEM_NAME} </p>', 'Welcome message on Dashboard', array('USER_NAME' => 'Current user name', 'SYSTEM_NAME' => 'System name from settings area'));
public function delete_member($member_id) { $member_id = (int) $member_id; $member = self::get_member($member_id); if ($member && $member['member_id'] == $member_id) { $sql = "DELETE FROM " . _DB_PREFIX . "member WHERE member_id = '" . $member_id . "' LIMIT 1"; query($sql); module_extra::delete_extras('member', 'member_id', $member_id); if (class_exists('module_group', false)) { module_group::delete_member($member_id, 'member'); module_group::delete_member($member_id, 'newsletter_subscription'); } hook_handle_callback('member_deleted', $member_id); } }
$upcoming_finance_key++; } unset($upcoming_finances_unsorted); // now we add any upcoming invoice payments to the finance listing. // now we add any upcoming subscription payments to the finance listings. if (function_exists('hook_handle_callback')) { // don't hook into others when searching on particular items. $block_hook_when_searching = array('finance_category_id', 'finance_account_id'); $block_hook = false; foreach ($block_hook_when_searching as $key) { if (isset($search[$key]) && strlen($search[$key]) > 0) { $block_hook = true; } } if (!$block_hook) { $others = hook_handle_callback('finance_recurring_list', $search); if (is_array($others) && count($others)) { foreach ($others as $other) { if (is_array($other) && count($other)) { // this should be a list of compatible upcoming finance items. // these items wont have a "record" button // these items will have their own url to open them (ie: not take them to the normal recurring edit screen) foreach ($other as $o) { $upcoming_finances[] = $o; } } } } } } // sort finances by their next_due_date
function customer_admin_email_generate_invoice_list($invoices, $customer_id) { ob_start(); $colspan = 9; $colspan2 = 0; $invoice_total = array(); $invoice_total_due = array(); foreach ($invoices as $invoice) { if (!isset($invoice_total[$invoice['currency_id']])) { $invoice_total[$invoice['currency_id']] = 0; } if ($invoice['c_total_amount'] == 0) { $invoice = module_invoice::get_invoice($invoice['invoice_id']); } $invoice_total[$invoice['currency_id']] += $invoice['c_total_amount']; if (!isset($invoice_total_due[$invoice['currency_id']])) { $invoice_total_due[$invoice['currency_id']] = 0; } $invoice_total_due[$invoice['currency_id']] += $invoice['c_total_amount_due']; } $table_manager = module_theme::new_table_manager(); $columns = array(); $columns['invoice_number'] = array('title' => 'Invoice Number', 'callback' => function ($invoice) { //echo module_invoice::link_open($invoice['invoice_id'],true,$invoice); echo '<a href="' . module_invoice::link_public($invoice['invoice_id']) . '">' . htmlspecialchars($invoice['name']) . '</a>'; }, 'cell_class' => 'row_action'); $columns['invoice_status'] = array('title' => 'Status', 'callback' => function ($invoice) { echo htmlspecialchars($invoice['status']); }); $columns['invoice_create_date'] = array('title' => 'Create Date', 'callback' => function ($invoice) { if (!$invoice['date_create'] || $invoice['date_create'] == '0000-00-00') { //echo print_date($invoice['date_created']); } else { echo print_date($invoice['date_create']); } }); $columns['invoice_due_date'] = array('title' => 'Due Date', 'callback' => function ($invoice) { if ((!$invoice['date_paid'] || $invoice['date_paid'] == '0000-00-00') && strtotime($invoice['date_due']) < time()) { echo '<span class="error_text">'; echo print_date($invoice['date_due']); echo '</span>'; } else { echo print_date($invoice['date_due']); } }); $columns['invoice_sent_date'] = array('title' => 'Sent Date', 'callback' => function ($invoice) { if ($invoice['date_sent'] && $invoice['date_sent'] != '0000-00-00') { ?> <?php echo print_date($invoice['date_sent']); ?> <?php } else { ?> <span class="error_text"><?php _e('Not sent'); ?> </span> <?php } }); $columns['invoice_paid_date'] = array('title' => 'Paid Date', 'callback' => function ($invoice) { if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') { ?> <?php echo print_date($invoice['date_paid']); ?> <?php } else { if ($invoice['date_cancel'] && $invoice['date_cancel'] != '0000-00-00') { ?> <span class="error_text"><?php _e('Cancelled'); ?> </span> <?php } else { if ($invoice['overdue']) { ?> <span class="error_text" style="font-weight: bold; text-decoration: underline;"><?php _e('Overdue'); ?> </span> <?php } else { ?> <span class="error_text"><?php _e('Not paid'); ?> </span> <?php } } } }); if (class_exists('module_website', false) && module_website::is_plugin_enabled() && module_website::can_i('view', module_config::c('project_name_plural', 'Websites'))) { $colspan++; $columns['invoice_website'] = array('title' => module_config::c('project_name_single', 'Website'), 'callback' => function ($invoice) { if (isset($invoice['website_ids'])) { foreach ($invoice['website_ids'] as $website_id) { if ((int) $website_id > 0) { echo module_website::link_open($website_id, true); echo '<br/>'; } } } }); } $columns['invoice_job'] = array('title' => 'Job', 'callback' => function ($invoice) { foreach ($invoice['job_ids'] as $job_id) { if ((int) $job_id > 0) { //echo module_job::link_open($job_id,true); $job_data = module_job::get_job($job_id); echo '<a href="' . module_job::link_public($job_id) . '">' . htmlspecialchars($job_data['name']) . '</a>'; if ($job_data['date_start'] && $job_data['date_start'] != '0000-00-00' && $job_data['date_renew'] && $job_data['date_renew'] != '0000-00-00') { _e(' (%s to %s)', print_date($job_data['date_start']), print_date(strtotime("-1 day", strtotime($job_data['date_renew'])))); } echo "<br/>\n"; } } hook_handle_callback('invoice_admin_list_job', $invoice['invoice_id']); }); if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers')) { $colspan++; $columns['invoice_customer'] = array('title' => 'Customer', 'callback' => function ($invoice) { echo module_customer::link_open($invoice['customer_id'], true); }); } $columns['c_invoice_total'] = array('title' => 'Invoice Total', 'callback' => function ($invoice) { echo dollar($invoice['total_amount'], true, $invoice['currency_id']); }); $columns['c_invoice_total_due'] = array('title' => 'Amount Due', 'callback' => function ($invoice) { echo dollar($invoice['total_amount_due'], true, $invoice['currency_id']); ?> <?php if ($invoice['total_amount_credit'] > 0) { ?> <span class="success_text"><?php echo _l('Credit: %s', dollar($invoice['total_amount_credit'], true, $invoice['currency_id'])); ?> </span> <?php } }); if (class_exists('module_extra', false)) { ob_start(); $colspan2 += module_extra::print_table_header('invoice'); // used in the footer calc. ob_end_clean(); $table_manager->display_extra('invoice', function ($invoice) { module_extra::print_table_data('invoice', $invoice['invoice_id']); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full vendor data before displaying each row so we have access to more details if (isset($row_data['invoice_id']) && (int) $row_data['invoice_id'] > 0) { return module_invoice::get_invoice($row_data['invoice_id']); } return array(); }; $table_manager->set_rows($invoices); if (module_config::c('invoice_list_show_totals', 1)) { $footer_rows = array(); foreach ($invoice_total + $invoice_total_due as $currency_id => $foo) { $currency = get_single('currency', 'currency_id', $currency_id); $footer_rows[] = array('invoice_number' => array('data' => '<strong>' . _l('%s Totals:', $currency && isset($currency['code']) ? $currency['code'] : '') . '</strong>', 'cell_colspan' => $colspan - 2, 'cell_class' => 'text-right'), 'c_invoice_total' => array('data' => '<strong>' . dollar(isset($invoice_total[$currency_id]) ? $invoice_total[$currency_id] : 0, true, $currency_id) . '</strong>'), 'c_invoice_total_due' => array('data' => '<strong>' . dollar(isset($invoice_total_due[$currency_id]) ? $invoice_total_due[$currency_id] : 0, true, $currency_id) . '</strong>'), 'row_bulk_action' => array('data' => ' ', 'cell_colspan' => $colspan2)); } $table_manager->set_footer_rows($footer_rows); } $table_manager->pagination = false; $table_manager->print_table(); return ob_get_clean(); }
public static function delete_invoice($invoice_id) { $invoice_id = (int) $invoice_id; if ((int) $invoice_id > 0 && self::can_i('delete', 'Invoices')) { hook_handle_callback('invoice_deleted', $invoice_id); $invoice_data = self::get_invoice($invoice_id); $sql = "DELETE FROM " . _DB_PREFIX . "invoice WHERE invoice_id = '" . $invoice_id . "' LIMIT 1"; $res = query($sql); $sql = "DELETE FROM " . _DB_PREFIX . "invoice_item WHERE invoice_id = '" . $invoice_id . "'"; $res = query($sql); $sql = "DELETE FROM " . _DB_PREFIX . "invoice_tax WHERE invoice_id = '" . $invoice_id . "'"; $res = query($sql); $sql = "DELETE FROM " . _DB_PREFIX . "invoice_payment WHERE invoice_id = '" . $invoice_id . "'"; $res = query($sql); $sql = "UPDATE " . _DB_PREFIX . "invoice SET renew_invoice_id = 0 WHERE renew_invoice_id = '" . $invoice_id . "'"; $res = query($sql); if (class_exists('module_note', false) && module_note::is_plugin_enabled()) { module_note::note_delete("invoice", $invoice_id); } if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) { module_extra::delete_extras('invoice', 'invoice_id', $invoice_id); } module_cache::clear('invoice'); module_cache::clear('job'); if ($invoice_data && $invoice_data['customer_id']) { module_customer::update_customer_status($invoice_data['customer_id']); } } }
public static function generate_form_actions($options) { // let the themes override this form action function. $result = hook_handle_callback('generate_form_actions', $options); if (is_array($result)) { // has been handed by a theme. return current($result); } $defaults = array('type' => 'action_bar', 'class' => 'action_bar', 'elements' => array()); $options = array_merge($defaults, $options); //todo - hook in here for themes. ob_start(); ?> <div class="<?php echo $options['class']; ?> "> <?php foreach ($options['elements'] as $element) { if (is_array($element) && !is_array(current($element))) { $element = array($element); } $element['fields'] = $element; ?> <span class="action"> <?php if (isset($element['fields'])) { ?> <span class="action_element"> <?php if (is_array($element['fields'])) { foreach ($element['fields'] as $dataid => $field) { if (is_array($field)) { // treat this as a call to the form generate option self::generate_form_element($field); echo ' '; } else { echo $field . ' '; } } } else { echo $element['fields']; } ?> </span> <?php } ?> </span> <?php } ?> </div> <?php return ob_get_clean(); }
public static function print_js($version = false) { // sort the js files by position uasort(self::$js_files, 'config_sort_css'); // use the css function for sorting, does the same thing. if (module_config::c('js_combine', 1)) { self::js_combine($version); } foreach (self::$js_files as $hash => $js_file_info) { if (strlen($js_file_info[2]) < 3) { // url is set to 'true', use the module/file name combo // see if there is a theme override for this js file. $js_file = 'includes/plugin_' . basename($js_file_info[0]) . '/js/' . basename($js_file_info[1]); // see if we have an override. $js_file = module_theme::include_ucm($js_file); ?> <script type="text/javascript" language="javascript" src="<?php echo _BASE_HREF . $js_file; echo $version && strpos('?', $js_file[1]) === false ? '?ver=' . $version : ''; ?> "></script> <?php } else { ?> <script type="text/javascript" language="javascript" src="<?php echo htmlspecialchars($js_file_info[2]); ?> "></script> <?php } } if (function_exists('hook_handle_callback')) { hook_handle_callback('header_print_js'); } }
</tbody> <?php module_extra::display_extras(array('owner_table' => 'invoice', 'owner_key' => 'invoice_id', 'owner_id' => $invoice['invoice_id'], 'layout' => 'table_row', 'allow_new' => module_job::can_i('create', 'Invoices'), 'allow_edit' => module_job::can_i('create', 'Invoices'))); ?> </table> <?php if ((int) $invoice_id > 0) { ?> <?php hook_handle_callback('invoice_sidebar', $invoice_id); ?> <?php } ?> <?php if ($invoice_id && $invoice_id != 'new') { $note_summary_owners = array(); // generate a list of all possible notes we can display for this invoice. // display all the notes which are owned by all the sites we have access to module_note::display_notes(array('title' => 'Credit Note Notes', 'owner_table' => 'invoice', 'owner_id' => $invoice_id, 'view_link' => module_invoice::link_open($invoice_id), 'public' => array('enabled' => true, 'title' => 'Public', 'text' => 'Yes, show this note in invoice', 'help' => 'If this is ticked then this note will be available to the customer and will be included in the {INVOICE_NOTES} shortcode in the invoice template.'))); if (module_job::can_i('edit', 'Invoices')) {
?> </tbody> </table> </div> <?php $fieldset_data = array('heading' => array('title' => _l('Invoice Payment History'), 'type' => 'h3'), 'elements_before' => ob_get_clean()); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); 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')); } } }
public function print_table_after() { hook_handle_callback('table_print_after', $this); }