Servoy 6.0.3

Servoy announcements

Servoy 6.0.3

Postby Jan Blok » Fri Nov 11, 2011 8:37 pm

We are pleased to announce the immediate availability of Servoy 6.0.3 release.

This version is available through the download option on the Servoy website and auto-update.
Always make a backup of your current Servoy installation (directory and database) before installing/upgrading.
To update a Servoy eclipse open Check for updates via help menu.

Client Changes
[fix] SVY-1003 NPE saving records when clicking outside of fields and tracking enabled
[fix] SVY-985 Fallback valuelist does not work
[fix] SVY-1015 Font Size Rendering problem in 6.0.1
[fix] SVY-1022 Duplicate dataprovider names in enumerate foundset

WebClient Changes
[fix] SVY-1052 IE fails to run the same code that firefox allows
[fix] SVY-979 List does not paginate correctly after editing a record in another form.
[fix] SVY-995 No onFocusGained() event firing
[fix] SVY-997 Dialog locks up when changing related tab panels
[fix] SVY-998 Combo box width is not correct.
[fix] SVY-1001 achoring issue
[fix] SVY-1025 onRecordEditStop() event is not firing
[fix] SVY-1026 Wicket Exception: Cannot modify component hierarchy after render phase has started

Application Server Changes
[fix] SVY-974 Issue checking out Solutions from a Remote App Server using the Servoy Team Provider
[fix] SVY-984 Servoy Team Provider (...startAsTeamProvider = true) takes into consideration .settings folder

Developers Changes
[fix] SVY-117 Variable Tooltip Display Problems in Debug
[fix] SVY-1004 Using Quick Fix to remove deprecated property rowBGColorCalculation does not work
[fix] SVY-1020 instanceof RuntimeChecks not working

Plugin/Beans Changes
[fix] SVY-930 [window plugin] getMenu() on a popup menu returns null for the positions where it should return a Menu
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Re: is this a bug or just me?

Postby rafig » Sun Nov 27, 2011 8:07 pm

Hi
I was just trying to whip up a simple stock movement global which will be called anytime there is a stock movement and passed a 'usage type' (I have edited out the params & bits not needed here...)
Code: Select all
/**
* @param {Number} $id_product
* @param {Number} $id_usage_type
* @param {Number} $quantity
*/
function es_addStockMove ( $id_product, $id_usage_type, $quantity )
{

   globals.id_product = $id_product; // set global to make global relation del_product work [globals.id_product -> product.id_product])

   // check type of usage and if needed adjust product stock level
   //Unknown   0
   //Added   1
   //Moved   2
   //Picked   3
   //Issued   4
   //Used   5
   //Wasted   6
   //Returned   7
   //Requisitioned   8
   //Subtracted   9
   //Adjusted   10
   //On Order   11
   //In Transit   12

   //locks related product
   var $success = databaseManager.acquireLock ( rel_product, 0 , 'es_prod_lock');
   if ( !$success )
   {
      plugins.dialogs.showWarningDialog ( 'Alert', 'Failed to get a lock', 'OK' );
   }
   else
   {
      switch ( $id_usage_type )
      {
         case 1:
         // added
         case 10:
            // adjusted - use -ve qty if adjust down
            rel_product.quantity_in_stock = rel_product.quantity_in_stock + $quantity;
            break;
         case 5:
         // used
         case 6:
         // wasted
         case 7:
            // returned
            rel_product.quantity_in_stock = rel_product.quantity_in_stock - $quantity;
            break;
         default:
      }
   }
   databaseManager.releaseAllLocks ( 'es_prod_lock' ) ;
}

The problem is that Servoy is doing a string concatenation instead of a numerical (integer) addition (as I was passing usage_type = 1) [so if quantity_in_stock was 25 & I 'added' 2 then 1, quantity_in_stock is now 2521 ! ]
I thought Servoy 6 was meant to know what data types things are , and it seems to as when I hover over each thing it shows the correct data type?
Surely I don't have to do more data type coercion over the param declaration etc.?
Please advise
Thanks

Rafi

[UPDATE : I just changed the code and put
Code: Select all
            rel_product.quantity_in_stock = Number(rel_product.quantity_in_stock) + Number($quantity);

in and it worked correctly, but I would still like to know why...
Servoy Certified Developer
Image
rafig
 
Posts: 704
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: is this a bug or just me?

Postby david » Mon Nov 28, 2011 10:11 am

rafig wrote:I thought Servoy 6 was meant to know what data types things are , and it seems to as when I hover over each thing it shows the correct data type?
Surely I don't have to do more data type coercion over the param declaration etc.?


Param declarations don't perform any data type coercion at the javascript engine level. They just help the Servoy method editor sort stuff out for you.

rafig wrote:
Code: Select all
   rel_product.quantity_in_stock = Number(rel_product.quantity_in_stock) + Number($quantity);

in and it worked correctly, but I would still like to know why...


Either one or both of your arguments that you are adding are strings. Assuming "rel_product.quantity_in_stock" is an integer field, are you passing in a string instead of an integer for $quantity?
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: is this a bug or just me?

Postby rafig » Mon Nov 28, 2011 10:55 am

david wrote:
rafig wrote:I thought Servoy 6 was meant to know what data types things are , and it seems to as when I hover over each thing it shows the correct data type?
Surely I don't have to do more data type coercion over the param declaration etc.?


Param declarations don't perform any data type coercion at the javascript engine level. They just help the Servoy method editor sort stuff out for you.

OK, thanks...

david wrote:
rafig wrote:
Code: Select all
   rel_product.quantity_in_stock = Number(rel_product.quantity_in_stock) + Number($quantity);

in and it worked correctly, but I would still like to know why...


Either one or both of your arguments that you are adding are strings. Assuming "rel_product.quantity_in_stock" is an integer field, are you passing in a string instead of an integer for $quantity?

rel_product.quantity_in_stock is an integer (tool tip says number) & in the JSDoc param I declared $quantity as number (& tool tip says number), so neither are strings...

Thanks

Rafi
Servoy Certified Developer
Image
rafig
 
Posts: 704
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: is this a bug or just me?

Postby david » Mon Nov 28, 2011 11:11 am

rafig wrote:rel_product.quantity_in_stock is an integer (tool tip says number) & in the JSDoc param I declared $quantity as number (& tool tip says number), so neither are strings...


rel_product.quantity_in_stock is whatever the column type is in the table and $quantity is whatever type you pass into the function. Neither has anything to do with the param declarations!

For example, if you call your method with:

Code: Select all
es_addStockMove ( someRecord.id_product, 10.5, { $quantity: "45" } )


you get some ID, a number and an object regardless of your param declarations.

Check to see if you are calling your method with:

Code: Select all
es_addStockMove ( someRecord.id_product, "10", "45" )


You should be doing this instead:

Code: Select all
es_addStockMove ( someRecord.id_product, 10, 45 )
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: is this a bug or just me?

Postby rafig » Mon Dec 19, 2011 7:17 pm

Hi David,
[sorry for not replying sooner, bit behind on my emails & missed this...]
david wrote:Check to see if you are calling your method with:

Code: Select all
es_addStockMove ( someRecord.id_product, "10", "45" )


You should be doing this instead:

Code: Select all
es_addStockMove ( someRecord.id_product, 10, 45 )

I am not doing that explicitly, but am passing the parameter after loading a related set of records into a variable
Code: Select all
tab_detail = rel_scanned_items; // save all the related detail records in memory

and then looping thru all the lines of the 'tab_detail', I am then passing in
Code: Select all
tab_detail.quantity

so maybe that is changing it to a string...

Anyway, it is now working, so thanks...
Servoy Certified Developer
Image
rafig
 
Posts: 704
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK


Return to Announcements

Who is online

Users browsing this forum: No registered users and 13 guests