PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.6.7
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.6.7
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 / modules / accounting / includes / classes / class-ledger-map.php

class-ledger-map.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.6.7, at modules/accounting/includes/classes/class-ledger-map.php

40 lines 930 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WeDevs\ERP\Accounting\Includes\Classes;
4
5 class Ledger_Map {
6 private static $instance = null;
7
8 public $ledgers;
9
10 private function __construct() {
11 global $wpdb;
12
13 $this->ledgers = $wpdb->get_results( "SELECT slug, id, chart_id, category_id, name, code FROM {$wpdb->prefix}erp_acct_ledgers", OBJECT_K );
14 }
15
16 public static function get_instance() {
17 if ( null === static::$instance ) {
18 static::$instance = new Ledger_Map();
19 }
20
21 return static::$instance;
22 }
23
24 public function get_ledger_id_by_slug( $slug ) {
25 if ( ! empty( $this->ledgers[ $slug ] ) ) {
26 return $this->ledgers[ $slug ]->id;
27 }
28
29 return false;
30 }
31
32 public function get_ledger_details_by_slug( $slug ) {
33 if ( ! empty( $this->ledgers[ $slug ] ) ) {
34 return $this->ledgers[ $slug ];
35 }
36
37 return false;
38 }
39 }
40