PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.3.13
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.3.13
1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 All 143 releases
erp / includes / class-tracker.php

class-tracker.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.3.13, at includes/class-tracker.php

53 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WeDevs\ERP;
3
4 /**
5 * Tracker class
6 */
7 class Tracker extends \WeDevs_Insights {
8
9 public function __construct() {
10
11 $notice = __( 'Want to help make <strong>WP ERP</strong> even more awesome? Allow weDevs to collect non-sensitive diagnostic data and usage information.', 'erp' );
12
13 parent::__construct( 'erp', 'WP ERP', WPERP_FILE, $notice );
14 }
15
16 /**
17 * Get the extra data
18 *
19 * @return array
20 */
21 protected function get_extra_data() {
22 $data = array(
23 'active_modules' => get_option( 'erp_modules', [] ),
24 'contacts' => $this->get_people_count( 'contact' ),
25 'customer' => $this->get_people_count( 'customer' ),
26 'vendor' => $this->get_people_count( 'vendor' ),
27 'sales' => $this->transaction_type_count( 'sales' ),
28 'expense' => $this->transaction_type_count( 'expense' ),
29 );
30
31 return $data;
32 }
33
34 /**
35 * Get people type count
36 *
37 * @param string $type
38 *
39 * @return integer
40 */
41 private function get_people_count( $type ) {
42 return \WeDevs\ERP\Framework\Models\People::type( $type )->count();
43 }
44
45 private function transaction_type_count( $type ) {
46 if ( ! class_exists( '\WeDevs\ERP\Accounting\Model\Transaction' ) ) {
47 require_once WPERP_MODULES . '/accounting/includes/models/transaction.php';
48 }
49
50 return \WeDevs\ERP\Accounting\Model\Transaction::type( $type )->count();
51 }
52 }
53