phpCOIN
Merry Christmas

  Reply to this topicStart new topicStart Poll

> Warning Adding Order - Missing 2nd Argument, PHPCoin v1.6.5
SemoTech
  Posted: June 30, 2011 02:31 pm
Quote Post


Member
**

Group: Members
Posts: 10
Member No.: 3,821
Joined: April 18, 2009



Hello,

There seems to be a problem with one of the functions in PHPCoin 1.6.5 as follows:

Manually adding an order on behalf of an existing client results in this warning being posted:

CODE
Warning: Missing argument 2 for do_set_invc_values(), called in /home/semotech/public_html/coin_modules/orders/orders_funcs.php on line 1713 and defined in /home/semotech/public_html/coin_includes/common.php on line 1439


I looked at the lines specified and it is true, in the file "commpn.php" there is a function called "do_set_invc_values" on line 1439 and it takes 2 parameters ("$ainvc_id, $aadd")

The entire function looks like this:

CODE

function do_set_invc_values($ainvc_id, $aadd) {
# Dim some Vars
 global $_CCFG, $_TCFG, $_DBCFG, $db_coin, $_LANG, $_nl, $_sp;

# Get invoice values now (need tax percent for recalc
 $idata_now = do_get_invc_values($ainvc_id);

# Get invoice calc new values
 $idata_now['invc_id'] = $ainvc_id;
 $idata_new   = do_calc_invc_values($idata_now);

# Do update
 $query   = 'UPDATE '.$_DBCFG['invoices'].' SET ';
 $query  .= "invc_total_cost='".$idata_new['invc_total_cost']."', ";
 $query  .= "invc_subtotal_cost='".$idata_new['invc_subtotal_cost']."', ";
 $query  .= "invc_tax_01_amount='".$idata_new['invc_tax_01_amount']."', ";
 $query  .= "invc_tax_02_amount='".$idata_new['invc_tax_02_amount']."' ";
 $query  .= 'WHERE invc_id='.$ainvc_id;
 $result = $db_coin->db_query_execute($query) OR DIE("Unable to complete request");
 $numrows = $db_coin->db_query_affected_rows();

# Update Invoice Debit Transaction
 $q_it   = 'UPDATE '.$_DBCFG['invoices_trans'].' SET ';
 $q_it  .= "it_amount='".$idata_new['invc_total_cost']."' ";
 $q_it  .= 'WHERE it_invc_id='.$ainvc_id.' AND it_type=0';
 $r_it  = $db_coin->db_query_execute($q_it) OR DIE("Unable to complete request");

# If no invoice transaction was updated, then create one
 IF ($aadd && $r_it == FALSE) {
  IF (!$idata_new['invc_ts']) {$idata_new['invc_ts'] = dt_get_uts();}
  $_it_def = 0;
  $_it_desc = $_LANG['_INVCS']['l_Invoice_ID'].' - '.$ainvc_id;
  $q2_it  = 'INSERT INTO '.$_DBCFG['invoices_trans'].' (';
  $q2_it .= 'it_ts, it_invc_id, it_type';
  $q2_it .= ', it_origin, it_desc, it_amount';
  $q2_it .= ') VALUES ( ';
  $q2_it .= "'".$db_coin->db_sanitize_data($idata_new['invc_ts'])."', ";
  $q2_it .= "'".$db_coin->db_sanitize_data($ainvc_id)."', ";
  $q2_it .= "'".$db_coin->db_sanitize_data($_it_def)."', ";
  $q2_it .= "'".$db_coin->db_sanitize_data($_it_def)."', ";
  $q2_it .= "'".$db_coin->db_sanitize_data($_it_desc)."', ";
  $q2_it .= "'".$db_coin->db_sanitize_data($idata_new['invc_total_cost'])."'";
  $q2_it .= ")";
  $r2_it = $db_coin->db_query_execute($q2_it);
 }

# Set return
 return $numrows;
}


However, when the function is called from the "/orders/orders_funcs.php" file on line 1713 the call is with one argument, not 2 as follows:

CODE

# Calculate taxes and update
 $updated = do_set_invc_values($_ins_invc_id);


The "$aadd" variable is missing!

Please advise....

Thank you.
PMEmail Poster
Top
lightman
Posted: June 30, 2011 02:36 pm
Quote Post


The Janitor
***

Group: Admin
Posts: 3,641
Member No.: 3
Joined: August 25, 2006



Please post instructions on how to replicate on the http://cpdemo.phpcoin.com site.

I have just logged in as an admin, and created an order on behalf of a client with no problems.


--------------------
***** Unless otherwise stated, all replies refer to the following *****
====================================================================
--- The latest unmodified version of phpCOIN available from the phpCOIN download page on the date and time of this post.
--- All relevant HotFix files applied - One of the four included unmodified themes - The original language files .
--- Help will be given to install/configure/use phpCOIN, but not programming help to modify phpCOIN operations. If you are competent enough to make programming changes, you should be competent enough to read the source code and figure things out :)
PM
Top
SemoTech
Posted: June 30, 2011 02:52 pm
Quote Post


Member
**

Group: Members
Posts: 10
Member No.: 3,821
Joined: April 18, 2009



QUOTE (lightman @ June 30, 2011 01:36 pm)
Please post instructions on how to replicate on the http://cpdemo.phpcoin.com site.

I have just logged in as an admin, and created an order on behalf of a client with no problems.

Hi lightman and thanks for the prompt reply.

Sorry, but nothing fancy. I was logged-in as Admin and went to Orders and new order. Selected an existing client and created the order. Nothing special.

Can you please check the code of the 2 functions as detailed above in my original post? Do you have 2 parameters or only one like I do????

Thank you.

P.S. Only thing is that I am running PHP 5.3.6 and MySQL 5.1.56 but that should not affect the fact that the defined function has 2 parameters and it is called with just one!
PMEmail Poster
Top
lightman
Posted: June 30, 2011 03:00 pm
Quote Post


The Janitor
***

Group: Admin
Posts: 3,641
Member No.: 3
Joined: August 25, 2006



phpCOIN v1.6.5 is unsupported on PHP 5.3.x !!!!

Please see http://docs.phpcoin.com/index.php/Pre-requisites

Frankly, I am surprised that you got phpCOIN v1.6.5 to work on a PHP 5.3.x environment at all - all the tests I made on the PHP 5.3 platforms wouldn't even install and just provoked white screens and endless Warnings and Critical errors in the logs !!


There used to be a phpCOIN v.1.6.6 Development Snapshot that was supposedly coded to be compatible with PHP 5.3.x and contained the last code changes that cantex made before his death, but an audit showed so many code errors that it was withdrawn from distribution. See this post for details.

I have no plans to release a PHP 5.3.x compatible version of phpCOIN until we can find a new new lead developer to take on the phpCOIN project - since no-one has indicated any interest for over a year now - the likelihood of the project moving forward is looking bleak. See this announcement


--------------------
***** Unless otherwise stated, all replies refer to the following *****
====================================================================
--- The latest unmodified version of phpCOIN available from the phpCOIN download page on the date and time of this post.
--- All relevant HotFix files applied - One of the four included unmodified themes - The original language files .
--- Help will be given to install/configure/use phpCOIN, but not programming help to modify phpCOIN operations. If you are competent enough to make programming changes, you should be competent enough to read the source code and figure things out :)
PM
Top
SemoTech
Posted: June 30, 2011 03:46 pm
Quote Post


Member
**

Group: Members
Posts: 10
Member No.: 3,821
Joined: April 18, 2009



QUOTE (lightman @ June 30, 2011 02:00 pm)
phpCOIN is unsupported on PHP 5.3.x !!!!


I understand and I am sorry to hear it. I hope you find a good developer soon. It would be a shame to loose this system.

In my case this issue does not seem related to PHP as this is not a "deprecated function" warning, but seems like a bug in the code. It is possible that the "old" PHP ignored it but I am still curious if your code matches mine.

Do your have both parameters in the [do_set_invc_values] function of the "/orders/orders_funcs.php" file on line 1713 ???

Thanks.
PMEmail Poster
Top
lightman
Posted: June 30, 2011 03:49 pm
Quote Post


The Janitor
***

Group: Admin
Posts: 3,641
Member No.: 3
Joined: August 25, 2006



QUOTE
Do your have both parameters in the [do_set_invc_values] function of the "/orders/orders_funcs.php" file on line 1713 ???
Yes smile.gif


--------------------
***** Unless otherwise stated, all replies refer to the following *****
====================================================================
--- The latest unmodified version of phpCOIN available from the phpCOIN download page on the date and time of this post.
--- All relevant HotFix files applied - One of the four included unmodified themes - The original language files .
--- Help will be given to install/configure/use phpCOIN, but not programming help to modify phpCOIN operations. If you are competent enough to make programming changes, you should be competent enough to read the source code and figure things out :)
PM
Top
SemoTech
  Posted: June 30, 2011 08:09 pm
Quote Post


Member
**

Group: Members
Posts: 10
Member No.: 3,821
Joined: April 18, 2009



OK, so something must be up with my code... I will re-download v1.6.5 and do a file comparison to try to find out why my files are different.

Thanks again.
PMEmail Poster
Top
SemoTech
  Posted: June 30, 2011 08:20 pm
Quote Post


Member
**

Group: Members
Posts: 10
Member No.: 3,821
Joined: April 18, 2009



Hi lightman,

I just downloaded v1.6.5 from your site and compared the file ("coin_modules\orders\orders_funcs.php") with my version.

BOTH are identical, so that means that the "Official" release v1.6.5 is also missing the 2nd argument for the "do_set_invc_values" function in "orders_funcs.php"!

Your code must not be v1.6.5 but custom or updated.


Please check again against release code to confirm. Look at lines 1712 & 1713, the code is:

CODE

# Calculate taxes and update
 $updated = do_set_invc_values($_ins_invc_id);


The above in the code is a bug as the function expects 2 arguments in "common.php"!
PMEmail Poster
Top
lightman
Posted: July 01, 2011 03:31 am
Quote Post


The Janitor
***

Group: Admin
Posts: 3,641
Member No.: 3
Joined: August 25, 2006



Sorry, too late at night and too tired - was looking in the common.php file sad.gif

The code as used in the demo site is phpCOIN v1.6.5 and the only modifications are that the email functions only simulate sending a mail.

From my perspective, this is just one of many issues that phpCOIN has with the PHP 5.3.x platform, and my comments above still apply.

If you are going to start debugging phpCPIN for PHP 5,3,x - you better be prepared to go through every file and replace all the ereg(i) statements as well - there are aver 200 instances that need addressing - and just about EVERY variable needs initialising etc etc etc

Good luck biggrin.gif


--------------------
***** Unless otherwise stated, all replies refer to the following *****
====================================================================
--- The latest unmodified version of phpCOIN available from the phpCOIN download page on the date and time of this post.
--- All relevant HotFix files applied - One of the four included unmodified themes - The original language files .
--- Help will be given to install/configure/use phpCOIN, but not programming help to modify phpCOIN operations. If you are competent enough to make programming changes, you should be competent enough to read the source code and figure things out :)
PM
Top
SemoTech
  Posted: July 01, 2011 03:07 pm
Quote Post


Member
**

Group: Members
Posts: 10
Member No.: 3,821
Joined: April 18, 2009



LOL, no worries, just wanted to be sure I was not crazy biggrin.gif

As for debugging PHPCoin, I'd love to but way above my skill set laugh.gif

Guess I can only hope you guys get a new lead developer and PHPCoin does not die a slow death, it would be such a shame for such a great platform.

Thanks again.
PMEmail Poster
Top
lightman
Posted: July 01, 2011 03:36 pm
Quote Post


The Janitor
***

Group: Admin
Posts: 3,641
Member No.: 3
Joined: August 25, 2006



It would be a great shame, especially as we have already invested over a quarter of a million euros into the project over the years !!!


--------------------
***** Unless otherwise stated, all replies refer to the following *****
====================================================================
--- The latest unmodified version of phpCOIN available from the phpCOIN download page on the date and time of this post.
--- All relevant HotFix files applied - One of the four included unmodified themes - The original language files .
--- Help will be given to install/configure/use phpCOIN, but not programming help to modify phpCOIN operations. If you are competent enough to make programming changes, you should be competent enough to read the source code and figure things out :)
PM
Top
SemoTech
  Posted: July 08, 2011 02:50 pm
Quote Post


Member
**

Group: Members
Posts: 10
Member No.: 3,821
Joined: April 18, 2009



QUOTE (lightman @ July 01, 2011 02:36 pm)
It would be a great shame, especially as we have already invested over a quarter of a million euros into the project over the years !!!

That's even worse to hear! So much money and effort.

When I bought my license everything looked so promising, I still can't believe what happened to Cantex and that all the work on v2.0 was lost, as I recall it being almost complete. Sad, very sad indeed!
PMEmail Poster
Top
tencsinage
Posted: December 23, 2012 11:12 am
Quote Post


Newbie
*

Group: Probation
Posts: 1
Member No.: 4,587
Joined: December 23, 2012



Hi everybody!


In the "/coin_modules/orders/orders_funcs.php" file.

The solution with the following code:

# Calculate taxes and update
$updated = do_set_invc_values($_ins_invc_id, $ainvc_id, $aadd);

Then it will work.
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 


Inscrita el Registro Mercantil de Mallorca Tomo 2140, Hoja No. PM-51034, Folio 135
This website owned and operated by: Technology Services RPVW S.L. CIF# B57345084
Avda Constitucion 48 Bajos Alaro 07340 Baleares SPAIN
Tel:+34 971518362    Fax: +34 971518368    eMail: support@phpcoin.com