This topic is locked
[SOLVED]

Q: How to get voucher numbers for selected orders in a list ?

2/6/2024 8:06:33 AM
PHPRunner General questions
N
Nikos Tsikas author

Hello to all.
I am a newcomer to phpRunner and I hope someone could help.
I have a list of orders.
From the whole list, I want the users to be able to select the order the want to, and by pressing a button, the software should:
a) call courier api, passing values for each order
b) get from courier api a newly created voucher
c) update the order with the new voucher and
d) print the order

I have read the manual about iterating and updating the selected rows from a list page, but the examples reffer to updating all rows at once on server event.
What I need, ideally, is that for each row, to go somehow in a tri-part event.
Is this possible and how ?
If not, what alternatives do I have?

Thank you

admin 2/6/2024

You cannot do multiple tri-part events at once, this is someply not how web applicatins work. You get ClientBefore, Server and ClientAfter.

Reading your task description I don't see any problems with processing mutiple records at once. Could you clarify what kind of issue you facing with this approach right now?

N
Nikos Tsikas author 2/7/2024

Could you clarify what kind of issue you facing with this approach right now?

Hi,
the issue(s) i am facing are two different onces.
If I iterate the selected rows on the javascript before event, I don't know how to update the underlying rows there. As far as I understand, the getSelectedRecords() exists, just to alter the appearance of the rows. Even with the GridRow object returned, according to the manual the row.setFieldText() only alters the displayed text and the row.setFieldValue() as stated "only applies to the consequent getFieldValue calls" and there is no any reference that the field's value in db gets updated.

If i iterate the rows in server part, I have another problem that is beyond my knowledge.
As i said, for each row, i need to call a courier webservice. The call is https post. Testing the call on my pc using postman, it works fine. Testing the code on my laptop using embedded server it also works fine. But, when I upload it to the web server, the API Calls fail, and I get an error that relates to ssl and certificates. I assume that there is something with apache, but I can't figure it out. Every search I made on the issue, ended up with information on how to enable ssl on apache as "request RECEIVING server" but in my case, in fact Apache (through the php code that runs on it) is in fact a client to another web server (the api server).
Note that my Apache is hosted internally in the network, not exposed to the internet. In fact it is an intranet server, with public name, accessed via ip only from pc's in the same network, therefore ssl configuration is as far as i know now possible. It is very very strange though that on my pc, the embedded server doesn't give the error, although it too doesn't have public name and lives only locally.

Thank you for your interest and will to assist.

admin 2/10/2024

As far as I understand, this is all about making a call to that web service. My suggestion is to make this call work in plain PHP, outside of PHPRunner.

Once you got it working there, you can plug in this working code in button's Server event.

N
Nikos Tsikas author 2/11/2024

Thank you.
I will try to figure out what needs to be done.