Apply changes from master

This commit is contained in:
jekkos
2022-11-18 00:57:23 +01:00
committed by Steve Ireland
parent f39509d45e
commit ace7c2b131
18 changed files with 135 additions and 58 deletions

37
.gitignore vendored
View File

@@ -1,33 +1,18 @@
# Dependency directories
/node_modules
/vendor
/public/bower_components
node_modules
vendor
public/bower_components
app/Config/email.php
app/sessions/*
app/logs/*
app/uploads/*
npm-debug.log*
# Build generated
/tmp
/public/license/.licenses
/public/license/bower.LICENSES
/public/dist
# Docker
!/docker/.env
/docker/data/database/db/*
/docker/data/certbot/conf/*
/docker/data/ospos/app/*
# Database
/database/database.sql
/database/migrate_phppos_dist.sql
# Use files
/application/config/email.php
/application/sessions/*
/application/uploads/*
!docker/.env
docker/data/database/db/*
docker/data/certbot/conf/*
docker/data/ospos/app/*
# Editors
## SublimeText
@@ -69,11 +54,11 @@ $RECYCLE.BIN/
.com.apple.timemachine.donotpresent
# Other
/generate_langauges.php
/dist
/docs
generate_languages.php
dist
docs
/patches
/translations
translations
/.buildpath
/.project
/.settings/*

View File

@@ -17,9 +17,7 @@ before_install:
script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker run --rm -v $(pwd):/app jekkos/composer composer install
- docker run --rm -v $(pwd):/app jekkos/composer php bin/install.php translations develop
- sed -i "s/'\(dev\)'/'$rev'/g" application/config/config.php
- docker run --rm -v $(pwd):/app opensourcepos/composer composer install
- version=$(grep application_version application/config/config.php | sed "s/.*=\s'\(.*\)';/\1/g")
- echo "$version-$branch-$rev"
- npm version "$version-$branch-$rev" --force || true

View File

@@ -11,7 +11,7 @@ class App extends BaseConfig
*
* @var string
*/
public $application_version = '3.4.0';
public $application_version = '4.0.0-dev';
/**
* This is the commit hash for the version you are currently using.

View File

@@ -1161,6 +1161,7 @@ class Reports extends Secure_Controller
'id' => $row['sale_id'],
'type_code' => $row['type_code'],
'sale_time' => to_datetime(strtotime($row['sale_time'])),
'sale_date' => to_date(strtotime($row['sale_date'])),
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'subtotal' => to_currency($row['subtotal']),
@@ -1275,7 +1276,7 @@ class Reports extends Secure_Controller
$summary_data[] = [
'id' => $row['sale_id'],
'type_code' => $row['type_code'],
'sale_time' => to_datetime(strtotime($row['sale_time'])),
'sale_date' => to_date(strtotime($row['sale_date'])),
'quantity' => to_quantity_decimals($row['items_purchased']),
'customer_name' => $row['customer_name'],
'subtotal' => to_currency($row['subtotal']),
@@ -1393,7 +1394,7 @@ class Reports extends Secure_Controller
$summary_data[] = [
'id' => $row['sale_id'],
'type_code' => $row['type_code'],
'sale_time' => to_datetime(strtotime($row['sale_time'])),
'sale_date' => to_date(strtotime($row['sale_date'])),
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'customer_name' => $row['customer_name'],
@@ -1543,7 +1544,7 @@ class Reports extends Secure_Controller
$tabular_data[] = [
'id' => $row['sale_id'],
'type_code' => $row['type_code'],
'sale_time' => to_datetime(strtotime($row['sale_time'])),
'sale_date' => to_date(strtotime($row['sale_date'])),
'name' => $row['name'],
'category' => $row['category'],
'item_number' => $row['item_number'],
@@ -1633,7 +1634,7 @@ class Reports extends Secure_Controller
$summary_data[] = [
'id' => $row['sale_id'],
'type_code' => $row['type_code'],
'sale_time' => to_datetime(strtotime($row['sale_time'])),
'sale_date' => to_date(strtotime($row['sale_date'])),
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'customer_name' => $row['customer_name'],
@@ -1766,7 +1767,7 @@ class Reports extends Secure_Controller
{
$summary_data[] = [
'id' => $row['receiving_id'],
'receiving_time' => to_datetime(strtotime($row['receiving_time'])),
'receiving_date' => to_date(strtotime($row['receiving_date'])),
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'supplier_name' => $row['supplier_name'],

18
app/Events/Save.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
namespace App\Events;
class Save
{
public static function validate_save()
{
$url = $_SERVER['REQUEST_URI'];
$is_save = preg_match('/save\/\d*?/', $url);
if($is_save && $_SERVER["REQUEST_METHOD"] != "POST" && empty($_POST))
{
echo "Method not allowed";
die;
}
}
}

View File

@@ -153,7 +153,7 @@ function get_sale_data_last_row(ResultInterface $sales): array
return [
'sale_id' => '-',
'sale_time' => '<b>'.lang('Sales.total').'</b>',
'sale_time' => lang('Sales.total'),
'amount_due' => '<b>'.to_currency($sum_amount_due).'</b>',
'amount_tendered' => '<b>'. to_currency($sum_amount_tendered).'</b>',
'change_due' => '<b>'.to_currency($sum_change_due).'</b>'
@@ -828,9 +828,9 @@ function get_expenses_data_last_row(object $expense): array
return [
'expense_id' => '-',
'date' => '<b>'.lang('Sales.total').'</b>',
'amount' => '<b>'. to_currency($sum_amount_expense).'</b>',
'tax_amount' => '<b>'. to_currency($sum_tax_amount_expense).'</b>'
'date' => lang('Sales.total'),
'amount' => to_currency($sum_amount_expense),
'tax_amount' => to_currency($sum_tax_amount_expense)
];
}

1
app/Language/.htaccess Normal file
View File

@@ -0,0 +1 @@
Deny from all

View File

@@ -14,7 +14,7 @@ class Token_lib
/**
* Expands all the tokens found in a given text string and returns the results.
*/
public function render(string $tokened_text, array $tokens = [], $save TRUE): string
public function render(string $tokened_text, array $tokens = [], $save = TRUE): string
{
// Apply the transformation for the "%" tokens if any are used
if(strpos($tokened_text, '%') !== FALSE)
@@ -128,12 +128,12 @@ class Token_lib
return $results;
}
public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens, $save = TRUE): array //TODO: $tokens
public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens, bool $save = TRUE): array //TODO: $tokens
{
foreach($used_tokens as $token_code => $token_info)
{
// Generate value here based on the key value
$token_value = $this->resolve_token($token_code, array(), $save);
$token_value = $this->resolve_token($token_code, [], $save);
foreach($token_info as $length => $token_spec)
{

View File

@@ -7,9 +7,9 @@ class Summary_taxes extends Summary_report
protected function _get_data_columns(): array //TODO: hungarian notation
{
return [
['tax_name' => $this->lang->line('reports_tax_name'), 'sortable' => FALSE],
['tax_name' => $this->lang->line('Reports.tax_name'), 'sorter' => FALSE],
['tax_percent' => lang('Reports.tax_percent'), 'sorter' => 'number_sorter'],
['report_count' => lang('Reports.sales'), 'sorter' => 'number_sorter'],
['report_count' => lang('Reports.sales'), sorter => 'number_sorter'],
['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'],
['tax' => lang('Reports.tax'), 'sorter' => 'number_sorter'],
['total' => lang('Reports.total'), 'sorter' => 'number_sorter']
@@ -86,4 +86,4 @@ class Summary_taxes extends Summary_report
return $query->getResultArray();
}
}
}

View File

@@ -27,8 +27,8 @@ class Token_invoice_sequence extends Token
/**
* @throws ReflectionException
*/
public function get_value(): string
public function get_value(bool $save = TRUE): string
{
return $this->appconfig->acquire_save_next_invoice_sequence();
return $this->appconfig->acquire_next_invoice_sequence($save);
}
}

View File

@@ -28,8 +28,8 @@ class Token_quote_sequence extends Token
/**
* @throws ReflectionException
*/
public function get_value(): string
public function get_value(bool $save = TRUE): string
{
return $this->appconfig->acquire_save_next_quote_sequence();
return $this->appconfig->acquire_next_quote_sequence($save);
}
}

View File

@@ -27,8 +27,8 @@ class Token_work_order_sequence extends Token
/**
* @throws ReflectionException
*/
public function get_value(): string
public function get_value(bool $save = TRUE): string
{
return $this->appconfig->acquire_save_next_work_order_sequence();
return $this->appconfig->acquire_next_work_order_sequence($save);
}
}

View File

@@ -148,7 +148,7 @@ $(document).ready(function()
$("a.fileinput-exists").click(function() {
$.ajax({
type: 'POST',
url: '<?php echo esc(site_url("$controller_name/remove_logo"), 'url') ?>',
url: '<?php echo esc(site_url("$controller_name/remove_logo"), 'url'); ?>',
dataType: 'json'
})
});

View File

@@ -65,7 +65,7 @@
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
</svg>
</span>
<input class="form-control" name="username" type="text" placeholder="<?php echo lang('Login.username'); ?>" aria-label="<?php echo lang('Login.username'); ?>" aria-describedby="input-username" <?php if (ENVIRONMENT == "testing") echo "value='admin'"; ?>>
<input class="form-control" name="username" type="text" placeholder="<?php echo lang('Login.username'); ?>" aria-label="<?php echo lang('Login.username') ?>" aria-describedby="input-username" <?php if (ENVIRONMENT == "testing") echo "value='admin'"; ?>>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="input-password">
@@ -74,6 +74,7 @@
<path d="M3.5 11.5a3.5 3.5 0 1 1 3.163-5H14L15.5 8 14 9.5l-1-1-1 1-1-1-1 1-1-1-1 1H6.663a3.5 3.5 0 0 1-3.163 2zM2.5 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/>
</svg>
</span>
<input class="form-control" name="password" type="password" placeholder="<?php echo lang('Login.password') ?>" aria-label="<?php echo lang('Login.password'); ?>" <?php if (ENVIRONMENT == "testing") echo "value='pointofsale'"; ?>" aria-describedby="input-password">
</div>
<?php endif; ?>

View File

@@ -3,10 +3,10 @@
<div id="footer">
<div class="jumbotron push-spaces">
<strong><?php echo lang('common_copyrights', date('Y')); ?> ·
<a href="https://opensourcepos.org" target="_blank"><?php echo lang('common_website'); ?></a> ·
<?php echo esc(config('OSPOS')->application_version) ?> - <a target="_blank" href="https://github.com/opensourcepos/opensourcepos/commit/<?php echo esc(config('OSPOS')->commit_sha1) ?>"><?php echo esc(substr(config('OSPOS')->commit_sha1, 0, 6)); ?></a></strong>.
<strong><?php echo lang('Common.copyrights', ['current_year' => date('Y')]) ?> ·
<a href="https://opensourcepos.org" target="_blank"><?php echo lang('Common.website') ?></a> ·
<?php echo esc(config('OSPOS')->application_version) ?> - <a target="_blank" href="https://github.com/opensourcepos/opensourcepos/commit/<?php echo esc(config('OSPOS')->commit_sha1) ?>"><?php echo esc(substr(config('OSPOS')->commit_sha1, 0, 6)); ?></a></strong>.
</div>
</div>
</body>
</html>
</html>

View File

@@ -226,6 +226,11 @@ $(document).ready(function()
{
dialog_support.hide();
table_support.handle_submit("<?php echo esc(site_url($controller_name), 'url') ?>", response);
const params = $.param(table_support.query_params());
$.get("<?php echo site_url($controller_name); ?>/search?" + params, function(response) {
$("#payment_summary").html(response.payment_summary);
}, 'json');
},
dataType: 'json'
});

View File

@@ -709,6 +709,26 @@ if(isset($success))
<script type="text/javascript">
$(document).ready(function()
{
const redirect = function() {
window.location.href = "<?php echo site_url('sales'); ?>";
};
$("#remove_customer_button").click(function()
{
$.post("<?php echo site_url('sales/remove_customer'); ?>", redirect);
});
$(".delete_item_button").click(function()
{
const item_id = $(this).data('item-id');
$.post("<?php echo site_url('sales/delete_item/'); ?>" + item_id, redirect);
});
$(".delete_payment_button").click(function() {
const item_id = $(this).data('payment-id');
$.post("<?php echo site_url('sales/delete_payment/'); ?>" + item_id, redirect);
});
$("input[name='item_number']").change(function() {
var item_id = $(this).parents('tr').find("input[name='item_id']").val();
var item_number = $(this).val();
@@ -971,6 +991,53 @@ function check_payment_type()
$(".non-giftcard-input").attr('disabled', false);
}
}
// Add Keyboard Shortcuts/Hotkeys to Sale Register
document.body.onkeyup = function(e)
{
switch(event.altKey && event.keyCode)
{
case 49: // Alt + 1 Items Seach
$("#item").focus();
$("#item").select();
break;
case 50: // Alt + 2 Customers Search
$("#customer").focus();
$("#customer").select();
break;
case 51: // Alt + 3 Suspend Current Sale
$("#suspend_sale_button").click();
break;
case 52: // Alt + 4 Check Suspended
$("#show_suspended_sales_button").click();
break;
case 53: // Alt + 5 Edit Amount Tendered Value
$("#amount_tendered").focus();
$("#amount_tendered").select();
break;
case 54: // Alt + 6 Add Payment
$("#add_payment_button").click();
break;
case 55: // Alt + 7 Add Payment and Complete Sales/Invoice
$("#add_payment_button").click();
window.location.href = "<?php echo site_url('sales/complete'); ?>";
break;
case 56: // Alt + 8 Finish Quote/Invoice without payment
$("#finish_invoice_quote_button").click();
break;
case 57: // Alt + 9 Open Shortcuts Help Modal
$("#show_keyboard_help").click();
break;
}
switch(event.keyCode)
{
case 27: // ESC Cancel Current Sale
$("#cancel_sale_button").click();
break;
}
}
</script>
<?php echo view('partial/footer') ?>

View File

@@ -40,6 +40,7 @@
"grunt-contrib-uglify": "~5.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-license-bower": "~1.0.1",
"load-grunt-tasks": "^3.4.0",
"grunt-script-link-tags": "https://github.com/jekkos/grunt-script-link-tags.git#master",
"grunt-wiredep": "^3.0.1",
"load-grunt-tasks": "^3.4.0"
@@ -49,4 +50,4 @@
"bootswatch-5": "npm:bootswatch@^5.1.3",
"npm": "^6.14.15"
}
}
}