diff --git a/README.md b/README.md index 964d36a..a131c32 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Welcome to software license manager 👋 -![Version](https://img.shields.io/badge/version-5.5.0-blue.svg?cacheSeconds=2592000) +![Version](https://img.shields.io/badge/version-5.5.2-blue.svg?cacheSeconds=2592000) [![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](https://documenter.getpostman.com/view/307939/6tjU1FL?version=latest) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/michelve/software-license-manager/blob/master/LICENSE.md) @@ -89,7 +89,7 @@ Changelog: [View changelog](https://github.com/michelve/software-license-manager Software License Manager -Software License Manager +Software License Manager ## 📝 License diff --git a/_config.yml b/_config.yml index 2f7efbe..c419263 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-minimal \ No newline at end of file +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/admin/slm-add-licenses.php b/admin/slm-add-licenses.php index 5c1b17f..96e9e8d 100755 --- a/admin/slm-add-licenses.php +++ b/admin/slm-add-licenses.php @@ -1,12 +1,10 @@ prepare("SELECT * FROM $lk_table WHERE id = %s", $id); $record = $wpdb->get_row($sql_prep, OBJECT); @@ -66,6 +66,8 @@ function slm_add_licenses_menu() $lic_type = $record->lic_type; $expiry_date = $record->date_expiry; $lic_item_ref = $record->item_reference; + $slm_billing_length = $record->slm_billing_length; + $slm_billing_interval = $record->slm_billing_interval; } if (isset($_POST['save_record'])) { @@ -78,7 +80,6 @@ function slm_add_licenses_menu() do_action('slm_add_edit_interface_save_submission'); //TODO - do some validation - $expiry_date = ''; $license_key = $_POST['license_key']; $max_domains = $_POST['max_allowed_domains']; $max_devices = $_POST['max_allowed_devices']; @@ -99,9 +100,19 @@ function slm_add_licenses_menu() $current_ver = $_POST['current_ver']; $subscr_id = $_POST['subscr_id']; $lic_type = $_POST['lic_type']; - $lic_item_ref = trim($_POST['item_reference']); + if("" == trim($_POST['item_reference'])){ + $lic_item_ref = 'default'; + } + else { + $lic_item_ref = trim($_POST['item_reference']); + } + + + $slm_billing_length = trim($_POST['slm_billing_length']); + $slm_billing_interval= trim($_POST['slm_billing_interval']); + $expiry_date = ''; if ($_POST['lic_type'] == 'lifetime'){ $expiry_date = '0000-00-00'; } @@ -120,32 +131,32 @@ function slm_add_licenses_menu() } //Save the entry to the database - $fields = array(); - $fields['license_key'] = $license_key; - $fields['max_allowed_domains'] = $max_domains; - $fields['max_allowed_devices'] = $max_devices; - $fields['lic_status'] = $license_status; - $fields['first_name'] = $first_name; - $fields['last_name'] = $last_name; - $fields['email'] = $email; - $fields['company_name'] = $company_name; - $fields['txn_id'] = $txn_id; - $fields['manual_reset_count'] = $reset_count; - $fields['purchase_id_'] = $purchase_id_; - $fields['date_created'] = $created_date; - $fields['date_renewed'] = $renewed_date; - $fields['date_activated'] = $date_activated; - $fields['date_expiry'] = $expiry_date; - $fields['product_ref'] = $product_ref; - $fields['until'] = $until; - $fields['current_ver'] = $current_ver; - $fields['subscr_id'] = $subscr_id; - $fields['lic_type'] = $lic_type; - $fields['item_reference'] = $lic_item_ref; - - - $id = isset($_POST['edit_record']) ? $_POST['edit_record'] : ''; - $lk_table = SLM_TBL_LICENSE_KEYS; + $fields = array(); + $fields['license_key'] = $license_key; + $fields['max_allowed_domains'] = $max_domains; + $fields['max_allowed_devices'] = $max_devices; + $fields['lic_status'] = $license_status; + $fields['first_name'] = $first_name; + $fields['last_name'] = $last_name; + $fields['email'] = $email; + $fields['company_name'] = $company_name; + $fields['txn_id'] = $txn_id; + $fields['manual_reset_count'] = $reset_count; + $fields['purchase_id_'] = $purchase_id_; + $fields['date_created'] = $created_date; + $fields['date_renewed'] = $renewed_date; + $fields['date_activated'] = $date_activated; + $fields['date_expiry'] = $expiry_date; + $fields['product_ref'] = $product_ref; + $fields['until'] = $until; + $fields['current_ver'] = $current_ver; + $fields['subscr_id'] = $subscr_id; + $fields['lic_type'] = $lic_type; + $fields['item_reference'] = $lic_item_ref; + $fields['slm_billing_length'] = $slm_billing_length; + $fields['slm_billing_interval'] = $slm_billing_interval; + $id = isset($_POST['edit_record']) ? $_POST['edit_record'] : ''; + $lk_table = SLM_TBL_LICENSE_KEYS; if (empty($id)) { //Insert into database @@ -164,39 +175,24 @@ function slm_add_licenses_menu() } } - if (empty($errors)) { - $message = "Record successfully saved!"; - echo '

'; - echo $message; - echo '

'; - } else { - echo '
' . $errors . '
'; - } - $data = array('row_id' => $id, 'key' => $license_key); do_action('slm_add_edit_interface_save_record_processed', $data); } ?> - - - - '; + echo ' + '; } ?> - - - +
+

@@ -263,7 +259,7 @@ function slm_add_licenses_menu()

@@ -525,7 +461,58 @@ function slm_add_licenses_menu() The number of times this license has been manually reset by the admin (use it if you want to keep track of it). It can be helpful for the admin to keep track of manual reset counts
+
+
+
+ +
+
+
Billing period
+
+
+
+
+ + + Amount in days or months or years +
+
+
+
+ + + Frequency period: in days, months, years +
+
+
+
+
@@ -533,7 +520,6 @@ function slm_add_licenses_menu() Creation date of license
-
- Expiry date of license
@@ -562,7 +547,6 @@ function slm_add_licenses_menu() Activation date
-
@@ -601,7 +585,6 @@ function slm_add_licenses_menu() No order found yet -
@@ -618,38 +601,38 @@ function slm_add_licenses_menu()
- prefix . 'postmeta'; - $item_ref_meta = '_license_item_reference'; - $sql_prep = $wpdb->prepare("SELECT DISTINCT(meta_value) FROM $post_meta_tbl WHERE meta_key = %s", $item_ref_meta); - $values_item_refs = $wpdb->get_results($sql_prep, OBJECT); + $post_meta_tbl = $wpdb->prefix . 'postmeta'; + $item_ref_meta = '_license_item_reference'; + $sql_prep = $wpdb->prepare("SELECT DISTINCT(meta_value) FROM $post_meta_tbl WHERE meta_key = %s", $item_ref_meta); + $values_item_refs = $wpdb->get_results($sql_prep, OBJECT); ?>
-
-
-
@@ -685,7 +668,6 @@ function slm_add_licenses_menu()
-
$id, 'key' => $license_key); @@ -695,24 +677,27 @@ function slm_add_licenses_menu() } ?>
-
- - Manage Licenses + + + Manage Licenses
-
- - - -
@@ -727,45 +712,31 @@ function slm_add_licenses_menu() + is_in_stock() ) : ?> - -
- apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), - // 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), - // 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // WPCS: CSRF ok, input var ok. - // ) - // ); - - // do_action( 'woocommerce_after_add_to_cart_quantity' ); - ?> -