sql stop working after updating from V5.76 to V5.92

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
wilmira
Veteran Member
Posts: 67
Joined: 2013-07-11 18:00

sql stop working after updating from V5.76 to V5.92

Post by wilmira » 2020-12-11 16:24

Hello everybody,

I have an app working fine developed with Appgini Version 5.76. After upgrading to Appgini V5.92, a couple of weeks ago, the systems is not working.

As an example, I have this code in a hook working perfecty fine:

$id_itemsorden=$data['selectedID'];
sql("update itemsorden left join menu on itemsorden.nombre_itemorden = menu.id_menu set itemsorden.precio_itemorden = menu.precio_menu where id_itemsorden ='$id_itemsorden'", $eo);
$pitemorden = sqlValue("SELECT precio_itemorden FROM itemsorden WHERE id_itemsorden = '$id_itemsorden' ");
$total_itemorden=money_format('%.2n',$pitemorden*$data['cant_itemorden']*(1+$data['iva_itemorden']/100));
sql("update itemsorden set total_itemorden='$total_itemorden' where id_itemsorden='$id_itemsorden'", $eo);

updatecfTotals($data['orden_item']);

After upgrading, that code stopped working. Has something changed in the sql sintax to be used in the new Appgini Version?

This is just a piece of code, I have worked a lot on this app in order to achieve what it is needed and it is taking me a lot of time trying to figure out how to replicate all the features of the app using the new calculated field tab in Version5.92, so I would like to keep the hooks approach, until I manage to learn how to do it withing the calculated tab in AppGini.

Thanks in advance for all the help.

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: sql stop working after updating from V5.76 to V5.92

Post by pfrumkin » 2020-12-11 16:38

I have had other trouble with v5.9x. I have stayed with v5.84. I would try v5.84 to better isolate where the failure is.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: sql stop working after updating from V5.76 to V5.92

Post by pbottcher » 2020-12-11 19:40

Hi,

if you say the code is not working any more? Are you getting errors? What is not working?
I feel the base sql syntax and functions did not change, so there might be another issue.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

wilmira
Veteran Member
Posts: 67
Joined: 2013-07-11 18:00

Re: sql stop working after updating from V5.76 to V5.92

Post by wilmira » 2020-12-11 20:02

Hello and thank you for your help.

To pfrumkin, I have tryed with Appgini V5.84, but did not solve the issue.

To pböttcher, that code is placed in after_insert and after_update in the same hook file.

I some installs, it only works in after_insert and in others, it won´t work in any case (neither in after_insert nor in after_update).

I am trying is in a local environment, I will try in a web server and see what happens.

I will let you know

Thank you both again

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: sql stop working after updating from V5.76 to V5.92

Post by D Oliveira » 2020-12-14 21:08

running 5.81 without problems, its seems to me that was the last stable version, I would give it a try, also the formatting of your code is a little different than what I use, for instance, where you wrote:

Code: Select all

WHERE id_itemsorden = '$id_itemsorden'
I would have written:

Code: Select all

WHERE id_itemsorden = '{$id_itemsorden}'
try re-writing the statements if downgrading the version doesn't work

wilmira
Veteran Member
Posts: 67
Joined: 2013-07-11 18:00

Re: sql stop working after updating from V5.76 to V5.92

Post by wilmira » 2020-12-16 18:03

I have found the issue: precio_itemorden is a lookup field, so in the past version of Appgini (working fine until now) I got the value from the parent table and updated the field in order to have the value, instead of the primary key. It seems this is not working anymore.

Another thing was that the iva_itemorden has a default value. It worked OK when inserting a new record, however, when editing that record, the default value was deleted, so that is why the script did not work.

Post Reply