Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stocks.php webERP v4.07.7
05-09-2012, 05:25 AM,
#1
Stocks.php webERP v4.07.7
Problem A:


Do the following:
1. Create stock category named "catX" having checkBox property named "chk1" and textBox property named "txtBox1".
2. Begin adding new item "itemA" which belongs to stock category "catX"
3. Make the "itemA" property "chk1" = true (checked)
4. Make the "itemA" property "txtBox1" = This text should be saved
5. Save

Problem:
The item is added but the category properties is not saved in the DB table stockitemproperties

Reason:
In the code you insert the category properties for the existing items only. it works when the flag $New == 0 but in the else block there is no insert query to the table stockitemproperties.

Solution:
I take the insert query from the first section ($New == 0) and COPIED it in the else block right after the stockmaster insert query. for me this is the first thing in the $db no errors check.

Begin from LINE 552:

if (DB_error_no($db) ==0) {
//now insert any item properties
for ($i=0;$i<$_POST['PropertyCounter'];$i++){

if ($_POST['PropType' . $i] ==2){
if ($_POST['PropValue' . $i]=='on'){
$_POST['PropValue' . $i]=1;
} else {
$_POST['PropValue' . $i]=0;
}
}
if ($_POST['PropNumeric' .$i]==1){
$_POST['PropValue' . $i]=filter_number_format($_POST['PropValue' . $i]);
} else {
$_POST['PropValue' . $i]=$_POST['PropValue' . $i];
}
$result = DB_query("INSERT INTO stockitemproperties (stockid,
stkcatpropid,
value)
VALUES ('" . $StockID . "',
'" . $_POST['PropID' . $i] . "',
'" . $_POST['PropValue' . $i] . "')",
$db,$ErrMsg,$DbgMsg,true);
} //end of loop around properties defined for the category


This solves the problem for me, but since I had not read the whole file you must confirm that this does not make any problems in another part of code.

Problem B:


Do the following:
1. Create stock category named "catX" having a checkBox property named "chk1"
2. Begin adding new item "itemA" which belongs to stock category "X"
3. Make the "itemA" property "chk1" = true (checked)
4. Save

Problem:
When selecting the item "itemA" in the page SelectProduct.php the property "chk1" is checked and yes this is the expected. But if you try to (Modify Item Details) which opens the Stocks.php you can find that the "chk1" property is not checked and this is not the expected.

solution:
Stocks.php ---> line 1177
echo '"checked"';

change it to:

echo 'checked';

This solved the problem for me.


Problem c:


Do the following:
1. The stock category named "catX" having a textbox property named "txtBox1" with minimum value = 0 and maximum value = 100
2. Add new item "itemA" which belongs to stock category "X"
3. Make the "itemA" property "txtBox1" = 120 (which is more than the maximum allowed value).
4. Save

Problem:
I expected a notification that property "txtBox1" exceeds the allowed value or something like that. But this did not happened, the item was saved and the txtBox1 property is 120 .

Solution:

in LINE 390:

if ($_POST['PropNumeric' .$i]==1){
$_POST['PropValue' . $i]=filter_number_format($_POST['PropValue' . $i]);

should be change to:

if ($_POST['PropNumeric' .$i]==1){
if ( filter_number_format($_POST['PropValue' . $i]) >= $PropertyRow['minimumvalue'] && filter_number_format($_POST['PropValue' . $i]) <= $PropertyRow['maximumvalue']){
$_POST['PropValue' . $i]=filter_number_format($_POST['PropValue' . $i]);
} else {
//I do not know the code to fire the webERP error but it should be used here.
}




Reply


Messages In This Thread
Stocks.php webERP v4.07.7 - by Ahmed.Fawzy - 05-09-2012, 05:25 AM
RE: Stocks.php webERP v4.07.7 - by Exsonqu_Qu - 05-09-2012, 06:04 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)