Apply changes from master

This commit is contained in:
jekkos
2022-11-13 00:59:23 +01:00
committed by jekkos
parent f84b795ee6
commit 2d45ca626b
11 changed files with 45 additions and 18 deletions

View File

@@ -186,6 +186,7 @@ function get_timezones(): array
'Asia/Kabul' => '(GMT+04:30) Kabul',
'Asia/Baku' => '(GMT+04:00) Baku',
'Asia/Yekaterinburg' => '(GMT+05:00) Ekaterinburg',
'Asia/Karachi' => '(GMT+05:00) Karachi, Islamabad',
'Asia/Tashkent' => '(GMT+05:00) Tashkent',
'Asia/Kolkata' => '(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi',
'Asia/Katmandu' => '(GMT+05:45) Kathmandu',

View File

@@ -122,7 +122,7 @@ $lang["reports_suppliers"] = "Suppliers";
$lang["reports_suppliers_summary_report"] = "Suppliers Summary Report";
$lang["reports_tax"] = "Tax";
$lang["reports_tax_category"] = "Tax Category";
$lang["reports_tax_name"] = "";
$lang["reports_tax_name"] = "Tax Name";
$lang["reports_tax_percent"] = "Tax Percent";
$lang["reports_tax_rate"] = "Tax Rate";
$lang["reports_taxes"] = "Taxes";

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 = []): 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)
@@ -39,7 +39,7 @@ class Token_lib
$token_values = [];
$tokens_to_replace = [];
$this->generate($token_tree, $tokens_to_replace, $token_values, $tokens);
$this->generate($token_tree, $tokens_to_replace, $token_values, $tokens, $save);
return str_replace($tokens_to_replace, $token_values, $tokened_text);
}
@@ -128,12 +128,12 @@ class Token_lib
return $results;
}
public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens): array //TODO: $tokens
public function generate(array $used_tokens, array &$tokens_to_replace, array &$token_values, array $tokens, $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);
$token_value = $this->resolve_token($token_code, array(), $save);
foreach($token_info as $length => $token_spec)
{
@@ -152,13 +152,13 @@ class Token_lib
return $token_values;
}
private function resolve_token($token_code, array $tokens = []): string
private function resolve_token($token_code, array $tokens = [], $save = TRUE): string
{
foreach(array_merge($tokens, Token::get_tokens()) as $token)
{
if($token->token_id() == $token_code)
{
return $token->get_value();
return $token->get_value($save);
}
}

View File

@@ -7,6 +7,7 @@ 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_percent' => lang('Reports.tax_percent'), 'sorter' => 'number_sorter'],
['report_count' => lang('Reports.sales')],
['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'],
@@ -64,9 +65,10 @@ class Summary_taxes extends Summary_report
. ' ELSE sales_items.quantity_purchased * (sales_items.item_unit_price - sales_items.discount) END)';
}
$query = $this->db->query("SELECT percent, COUNT(DISTINCT sale_id) AS count, ROUND(SUM(subtotal), $decimals) AS subtotal, ROUND(SUM(tax), $decimals) AS tax, ROUND(SUM(total), $decimals) AS total
$query = $this->db->query("SELECT name as name, percent, COUNT(DISTINCT sale_id) AS count, ROUND(SUM(subtotal), $decimals) AS subtotal, ROUND(SUM(tax), $decimals) AS tax, ROUND(SUM(total), $decimals) AS total
FROM (
SELECT
name AS name,
CONCAT(IFNULL(ROUND(percent, $decimals), 0), '%') AS percent,
sales.sale_id AS sale_id,
$sale_subtotal AS subtotal,

View File

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

View File

@@ -33,6 +33,7 @@ $(document).ready(function()
if($("#table tbody tr").length > 1) {
$("#payment_summary").html(response.payment_summary);
$("#table tbody tr:last td:first").html("");
$("#table tbody tr:last").css('font-weight', 'bold');
}
},
queryParams: function() {

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">
<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,7 +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') ?>" aria-describedby="input-password">
<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; ?>
<?php if(config('OSPOS')->gcaptcha_enable) {

View File

@@ -47,8 +47,23 @@
return ajax.apply(this, arguments);
};
$(document).ajaxComplete(setup_csrf_token);
$(document).ready(function(){
$("#logout").click(function(event) {
event.preventDefault();
$.ajax({
url: "<?php echo site_url('home/logout'); ?>",
data: {
"<?php echo $this->security->get_csrf_token_name(); ?>": csrf_token()
},
success: function() {
window.location.href = '<?php echo site_url(); ?>';
},
method: "POST"
});
});
});
var submit = $.fn.submit;

View File

@@ -64,7 +64,8 @@
data: <?php echo json_encode(esc($data, 'js')) ?>,
iconSize: 'sm',
paginationVAlign: 'bottom',
escape: false
escape: false,
search: true
});

View File

@@ -76,6 +76,7 @@
paginationVAlign: 'bottom',
detailView: true,
escape: false,
search: true,
onPageChange: init_dialog,
onPostBody: function() {
dialog_support.init("a.modal-dlg");

View File

@@ -24,6 +24,15 @@ $(document).ready(function()
<?php echo view('partial/bootstrap_tables_locale') ?>
table_support.query_params = function()
{
return {
start_date: start_date,
end_date: end_date,
filters: $("#filters").val() || [""]
}
};
table_support.init({
resource: '<?php echo esc(site_url($controller_name),'url') ?>',
headers: <?php echo esc($table_headers, 'js') ?>,
@@ -33,14 +42,11 @@ $(document).ready(function()
if($("#table tbody tr").length > 1) {
$("#payment_summary").html(response.payment_summary);
$("#table tbody tr:last td:first").html("");
$("#table tbody tr:last").css('font-weight', 'bold');
}
},
queryParams: function() {
return $.extend(arguments[0], {
start_date: start_date,
end_date: end_date,
filters: $("#filters").val() || [""]
});
return $.extend(arguments[0], table_support.query_params());
},
columns: {
'invoice': {