Skip to content

Commit

Permalink
Fixed: License type was not showing correctly when editing a license
Browse files Browse the repository at this point in the history
Fixed: Activation date was not displaying correctly when saving or adding new licenses
UPDATE: when a license is set to lifetime the expiration field will be disabled and ignore.
FIXED: when a license was set to lifetime the expiration was getting populated with a future date.
Improvement: fixed some typos and improved the Spanish language pack
Updated: updated the product type template to work with any theme.
  • Loading branch information
michelve committed Mar 31, 2020
1 parent 3c50ec3 commit 25b5e19
Show file tree
Hide file tree
Showing 12 changed files with 443 additions and 1,207 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Welcome to software license manager 👋
![Version](https://img.shields.io/badge/version-5.2.1-blue.svg?cacheSeconds=2592000)
![Version](https://img.shields.io/badge/version-5.3.1-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)

Expand Down
78 changes: 49 additions & 29 deletions admin/slm-add-licenses.php

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions admin/slm-lic-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ function slm_general_settings()
<td>
<p class="description"><input name="enable_debug" type="checkbox" <?php if ($options['enable_debug'] != '') echo ' checked="checked"'; ?> value="1" />
<?php _e('If checked, debug output will be written to log files (keep it disabled unless you are troubleshooting).', ' softwarelicensemanager '); ?></p>
- <?php _e('View debug log file by clicking', 'softwarelicensemanager'); ?> <a href="<?php echo SLM_URL . '/public/logs/log.txt'; ?>" target="_blank"><?php _e('here', ' softwarelicensemanager '); ?></a>..
- <?php _e('Reset debug log file by clicking', 'softwarelicensemanager'); ?> <a href="admin.php?page=slm_settings&slm_reset_log=1" target="_blank"><?php _e('here', ' softwarelicensemanager '); ?></a>.
</td>
</tr>
</table>
Expand Down
35 changes: 21 additions & 14 deletions admin/slm-list-licenses-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ function get_columns()
$columns = array(
'cb' => '<input type="checkbox" />', //Render a checkbox
'id' => 'ID',
'license_key' => 'Key',
'lic_status' => 'Status',
'lic_type' => 'Type',
'license_key' => 'Key',
'lic_type' => 'License type',
'email' => 'Email',
'max_allowed_domains' => 'Domains',
'max_allowed_devices' => 'Devices',
'purchase_id_' => 'Purchase #',
'purchase_id_' => 'Order #',
'date_created' => 'Created on',
'date_renewed' => 'Date Renewed',
'date_activated' => 'Date activated',
'date_renewed' => 'Renewed on',
'date_activated' => 'Activated on',
'date_expiry' => 'Expiration',
'until' => 'Until Ver.',
'current_ver' => 'Current Ver.'
Expand All @@ -112,16 +112,23 @@ function column_default($item, $column_name)
break;

case 'date_expiry':
$now = $item[$column_name];
$expiration = $item[$column_name];
$date_today = time();

if ($now != '0000-00-00') {
if (strtotime($now) < time()) {
return '<span class="slm-lic-expired-date"> ' . $now . ' </span>' . '<span class="days-left"> ' . SLM_Utility::get_days_remaining($now) . ' day(s) due</span>';
} else {
return '<span class="tag license-date-valid">' . $item[$column_name] . '</span>' . '<span class="days-left"> ' . SLM_Utility::get_days_remaining($now) . ' day(s) left</span>';
if ($expiration == '0000-00-00') {
return '<span class="tag license-date-valid"> Lifetime </span>' . '<span class="days-left"> </span>';
}


if ($expiration != '0000-00-00') {
if (strtotime($expiration) < time()) {
return '<span class="slm-lic-expired-date"> ' . $expiration . ' </span>' . '<span class="days-left"> ' . SLM_Utility::get_days_remaining($expiration) . ' day(s) due</span>';
}
else {
return '<span class="tag license-date-valid">' . $item[$column_name] . '</span>' . '<span class="days-left"> ' . SLM_Utility::get_days_remaining($expiration) . ' day(s) left</span>';
}
} else {
}
else {
//return $item[$column_name];
return '<span class="tag license-date-null">not set<span>';
}
Expand Down Expand Up @@ -303,11 +310,11 @@ private function sort_data($a, $b)
if (!empty($_GET['order'])) {
$order = $_GET['order'];
}
if ($orderby == 'id'){
if ($orderby == 'id'){
if ($a[$orderby]==$b[$orderby]){
$result = 0;
}else{
$result = ($a[$orderby]<$b[$orderby])?-1:1;
$result = ($a[$orderby]<$b[$orderby])?-1:1;
}
}else{
$result = strcmp($a[$orderby], $b[$orderby]);
Expand Down
4 changes: 2 additions & 2 deletions includes/slm-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ static function do_auto_key_expiry() {
foreach($licenses as $license){
$key = $license->license_key;
$expiry_date = $license->date_expiry;
if ($expiry_date == '0000-00-00'){
SLM_Debug_Logger::log_debug_st("This key (".$key.") doesn't have a valid expiry date set. The expiry of this key will not be checked.");
if ($expiry_date == '0000-00-00' || $expiry_date == '00000000' || $expiry_date == ''){
SLM_Debug_Logger::log_debug_st("This key (".$key.") doesn't have a valid expiration date set. The expiration of this key will not be checked.");
continue;
}

Expand Down
Binary file modified languages/softwarelicensemanager-es_ES.mo
Binary file not shown.
Loading

0 comments on commit 25b5e19

Please sign in to comment.