Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
odiea opened this issue May 3, 2024 · 17 comments
Open
1 task done

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

odiea opened this issue May 3, 2024 · 17 comments
Assignees
Labels
bug CodeIgniter4 Issue relates to the conversion to CodeIgniter 4
Milestone

Comments

@odiea
Copy link
Collaborator

odiea commented May 3, 2024

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
@odiea odiea added the bug label May 3, 2024
@jekkos jekkos added the CodeIgniter4 Issue relates to the conversion to CodeIgniter 4 label May 3, 2024
@jekkos jekkos added this to the 3.4.0 milestone May 3, 2024
@odiea
Copy link
Collaborator Author

odiea commented May 3, 2024

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 ?>);
});

@jekkos
Copy link
Member

jekkos commented May 4, 2024

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

@jekkos jekkos self-assigned this May 4, 2024
@odiea
Copy link
Collaborator Author

odiea commented May 4, 2024

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.

@WebShells
Copy link
Member

@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

@odiea
Copy link
Collaborator Author

odiea commented May 5, 2024

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.

@odiea
Copy link
Collaborator Author

odiea commented May 5, 2024

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

@odiea
Copy link
Collaborator Author

odiea commented May 5, 2024

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

@WebShells
Copy link
Member

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

@odiea
Copy link
Collaborator Author

odiea commented May 10, 2024

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.

@jekkos
Copy link
Member

jekkos commented May 11, 2024

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

@objecttothis
Copy link
Member

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.

@odiea
Copy link
Collaborator Author

odiea commented May 11, 2024

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.

@odiea
Copy link
Collaborator Author

odiea commented May 11, 2024

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

@jekkos
Copy link
Member

jekkos commented May 11, 2024

@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.

@jekkos
Copy link
Member

jekkos commented May 11, 2024

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

@objecttothis
Copy link
Member

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.

@jekkos jekkos closed this as completed May 12, 2024
@odiea
Copy link
Collaborator Author

odiea commented May 13, 2024

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

@jekkos jekkos reopened this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CodeIgniter4 Issue relates to the conversion to CodeIgniter 4
Projects
None yet
Development

No branches or pull requests

4 participants