billogram_install

Creates tables for WooCommerce Billogram.

Description

billogram_install(); 

Usage

  1. if ( !function_exists( 'billogram_install' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-billogram-integration/woocommerce-billogram2-extended.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = billogram_install(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/woocommerce-billogram2-extended.php  
  1. function billogram_install() { 
  2. global $wpdb; 
  3. $table_name = "wcb_orders"; 
  4. $sql = "CREATE TABLE IF NOT EXISTS ".$table_name."( id mediumint(9) NOT NULL AUTO_INCREMENT,  
  5. order_id MEDIUMINT(9) NOT NULL,  
  6. invoice_id VARCHAR( 20 ) NOT NULL,  
  7. invoice_no MEDIUMINT(20) NOT NULL,  
  8. ocr_number BIGINT(9) NOT NULL,  
  9. synced TINYINT(1) DEFAULT FALSE NOT NULL,  
  10. UNIQUE KEY id (id) 
  11. );"; 
  12.  
  13. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 
  14. dbDelta( $sql ); 
  15.  
  16. $table_name = "wcb_customers"; 
  17. $sql = "CREATE TABLE IF NOT EXISTS ".$table_name."( id mediumint(9) NOT NULL AUTO_INCREMENT,  
  18. customer_number VARCHAR(50) NULL,  
  19. email VARCHAR(100) NOT NULL,  
  20. UNIQUE KEY id (id),  
  21. UNIQUE (email) 
  22. );"; 
  23. dbDelta( $sql ); 
  24.  
  25. $table_name = "wcb_products"; 
  26. $sql = "CREATE TABLE IF NOT EXISTS ".$table_name."( id mediumint(9) NOT NULL AUTO_INCREMENT,  
  27. product_id MEDIUMINT(9) NULL,  
  28. product_sku VARCHAR(250) NOT NULL,  
  29. UNIQUE KEY id (id),  
  30. UNIQUE (product_sku) 
  31. );"; 
  32. dbDelta( $sql ); 
  33.  
  34. update_option('billogram_version', '2.46'); 
  35.  
  36. add_option('billogram-tour', true);