opensourcepos / opensourcepos

Open Source Point of Sale is a web based point of sale application written in PHP using CodeIgniter framework. It uses MySQL as the data back end and has a Bootstrap 3 based user interface.

Home Page:http://www.opensourcepos.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: No print or email sent when checked in Register

odiea opened this issue · comments

commented

Bug Description?

Make a Sale then check print after sale or send Receipt. Nothing happens

Steps to Reproduce?

Make a Sale then check print after sale or send Receipt. Nothing happens

Expected Behavior?

Should print after sell or send the customer an email receipt

OpensourcePOS Version

development (unreleased)

Php version

Php 8.2

What browsers are you seeing the problem on?

No response

Server Operating System and version

Wamp Server

Database Management System and version

Wamp Server

Web Server and version

Wamp Server

System Information Report (optional)

System Information Report

Unmodified copy of OpensourcePOS

  • I agree this copy has not been modified
commented

It does not like this function in views/partial/print_receipt. When I remove the $(window).load(function() it started working

$(window).load(function()
{
	// executes when complete page is fully loaded, including all frames, objects and images
	printdoc();

	// after a delay, return to sales view
	setTimeout(function () {
			window.location.href = "<?= site_url('sales') ?>";
		}, <?= $config['print_delay_autoreturn'] * 1000 ?>);
});

Perhaps it needs to become document.load(function() {}) that might be worth a try? Or did you just execute the function immediatly instead?

commented

I just left printdoc(); and placed the timeout into the printdoc() function. It also does not work until in config/receipt print always is enabled. The checkbox in the Register does not appear to control this function.

@odiea are you getting the following error upon clicking Print after sale ?

jquery-12e87d2f3a.js:9940
POST http://localhost/opensourcepos/public/http%3A%2F%2Flocalhost%2Fopensourcepos%2Fpublic%2Fsales%2Fset_print_after_sale 404 (Not Found)

The icons aren't loading also, i just want to make sure if that's the error is the cause of the option failure or its only my side.
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
addPayment:182 OTS parsing error: incorrect file size in WOFF header
addPayment:182 OTS parsing error

Thank you

commented

No I was not getting any errors that I noticed it was just not doing anything. All I do is check the error log or try to find something in Chrome inspect. No icon issues here But I do notice they are not showing on the Demo site. The print button on the Receipt page was working for me.

commented

I do see this error or warning on the Dev Demo.
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
addPayment:182 OTS parsing error: incorrect file size in WOFF header
addPayment:182 OTS parsing error

commented

I did more testing and yes I was getting the print_after_ sale error. I changed it to postPrint_after_sale and in the js I removed the 'url' and that issue went away but still no change

I'll look at it the in the upcoming days... If @jekkos had the chance to cover it that would be great...

commented

I found this on the web and it works. $(window).on('load', function () instead of $(window).load(function()
but the print_after sale checkbox appears to do nothing.

This seems to be due to a 404 missing route for set_print_after_sale in the sales controller. @objecttothis it's not completely clear to me when a route needs to be added? There are quite some functions in sales controller that used to be called using ajax, and that change the session state. Do they al need custom routes?
Eg beside this one there is also a functionality to set comments on the sale, etc

This seems to be due to a 404 missing route for set_print_after_sale in the sales controller. @objecttothis it's not completely clear to me when a route needs to be added? There are quite some functions in sales controller that used to be called using ajax, and that change the session state. Do they al need custom routes?
Eg beside this one there is also a functionality to set comments on the sale, etc

They don't need custom routes. The function in the controller needs to be renamed to add get or Post to the front of the name. So if the function uses POST and it's name is foo then it should be renamed to postFoo() in the controller.

commented

In the controller i changed it to postSet_print_after_sale. In register i removed the the 'url' due to garbage added. With Inspect i can see that it changes from true to false. When the Config Receipt is set to always it prints always unchecked always even after removing the check. In never unchecked it never prints even when it is checked.

commented

This is what happens when url is in the js.

$('#sales_print_after_sale').change(function() {
		$.post("<?= esc(site_url("$controller_name/set_print_after_sale"),'url') ?>", {sales_print_after_sale: $(this).is(':checked')});
	});```
Request URL:
http://localhost/ospos5/public/http%3A%2F%2Flocalhost%2Fospos5%2Fpublic%2Fsales%2Fset_print_after_sale
Request Method:
POST
Status Code:
404 Not Found
Remote Address:
[::1]:80
Referrer Policy:
same-origin

No url in the js

Request URL:
http://localhost/ospos5/public/sales/set_print_after_sale
Request Method:
POST
Status Code:
200 OK
Remote Address:
[::1]:80
Referrer Policy:
same-origin

@objecttothis I do see some routes were added for invoice and receipt views. I went through the sales/receivings and have changed all methods to camelcase so that we have consistent naming now
Also some routes were added for invoice and receipts by @WebShells . I have removed them again now and will try to use the method naming convention instead.

The print dialog seems to appear now, will check again tomorrow on dev

Super. I may be mistaken but I think very few of the custom routes are needed. Maybe reports, login, no access and maybe if we have one related to secure controller. Everything being namespaced removes a lot of the need for custom routes.

commented

What results do you get. Set print always in receipt config. Yes the check box is checked. Remove the check mark and it still prints when it should not. Set it to never. The checkbox is empty in the register check it to print the receipt. It does not print.g