0 Members and 1 Guest are viewing this topic.

Possible bug in payment.tpl
« on: December 21, 2017, 09:35:33 PM »
There may be bug in the current template in the following

Code: [Select]
        {if $memberships[$smarty.session.RoleId] == 'Free'}
           {elseif $memberships[$smarty.session.RoleId] == 'Gold'}
<div class="line_top_bottom_pad" align="center">
<br />&nbsp;&nbsp;{lang mkey='payment_msg1'}
</div>
        <div class="line_top_bottom_pad" align="center">
{include file="freefrm.tpl"}<br />
</div>
           {elseif $memberships[$smarty.session.RoleId] == 'Silver'}
              <div class="line_top_bottom_pad" align="center">
<br />&nbsp;&nbsp;{lang mkey='payment_msg1'}
</div>
        <div class="line_top_bottom_pad" align="center">
{include file="freefrm.tpl"}<br />
</div>
          {/if}

It seems like the Free payment method is not ever displayed and if a payment module exists, then 'Continue' will cause an error. 
PHPStorm, MAMP Pro, Sequel Pro
Currently converting my 2.1.6 site to osDateEvo 1.2

*

Pharg

  • *****
  • 3,069
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Possible bug in payment.tpl
« Reply #1 on: December 21, 2017, 10:21:45 PM »
Hi arievaul,

No this is not a bug, this was done to stop Free members upgrading to more Free when it wasn't needed.

Since the Free membership is set to Life in most cases, there is no need for a free payment method, they still get access to
upgrade to Silver or Gold via Paypal or what ever payment you have installed.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.1.15 | MySQL: 5.5.35

Re: Possible bug in payment.tpl
« Reply #2 on: December 22, 2017, 04:46:32 PM »
Hi Phill,

Thanks for the explanation. I was trying to figure out why the javascript was not being invoked and the error is between lines 14 and 36. Note that the 3 instances of 'elseif' are not recognized javascript and it should be 'else if'.

The code should have been written as this:
Code: [Select]
if ( form.payment_method[0].checked == true )
{ldelim}
if (form.membership.checked == 'free') {ldelim}
ErrorMsg[1] =  "{lang mkey='mship_errors' skey=4}";
ErrorCount++;
{rdelim}
{rdelim}
else if ( form.payment_method[1].checked == true )
{ldelim}
CheckFieldString("noblank",form.authorizenet_ccowner,"{lang mkey='signup_js_errors' skey='ccowner_noblank'}");
CheckFieldString("noblank",form.authorizenet_ccnumber,"{lang mkey='signup_js_errors' skey='ccnumber_noblank'}");
{rdelim}
else if ( form.payment_method[2].checked == true )
{ldelim}
{rdelim}
else if ( form.payment_method[3].checked == true )
{ldelim}
{rdelim}
else
{ldelim}
alert( "{lang mkey='signup_js_errors' skey='select_payment'}" );
return false;
{rdelim}

Cheers,
PHPStorm, MAMP Pro, Sequel Pro
Currently converting my 2.1.6 site to osDateEvo 1.2

*

Pharg

  • *****
  • 3,069
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Possible bug in payment.tpl
« Reply #3 on: December 22, 2017, 08:47:59 PM »
Hi arievaul,

Thanks for letting me know.

Not sure how or when that got changed, I know I never did the changes, will compare to version 2.6.5 to see
if it was the same.

I assume these changes are in the file payment.tpl

The full code is:
Code: [Select]
<script type="text/javascript">
/* <![CDATA[ */
function validate(form)
{ldelim}
ErrorCount=0;
ErrorMsg = new Array();
ErrorMsg[0]="------------------------- The Following Errors Occured -------------------------" + String.fromCharCode(13);

if ( form.payment_method == undefined ) {ldelim}
return true;
{rdelim}

if ( form.payment_method[0].checked == true )
{ldelim}
if (form.membership.checked == 'free') {ldelim}
ErrorMsg[1] =  "{lang mkey='mship_errors' skey=4}";
ErrorCount++;
{rdelim}
{rdelim}
else if ( form.payment_method[1].checked == true )
{ldelim}
CheckFieldString("noblank",form.authorizenet_ccowner,"{lang mkey='signup_js_errors' skey='ccowner_noblank'}");
CheckFieldString("noblank",form.authorizenet_ccnumber,"{lang mkey='signup_js_errors' skey='ccnumber_noblank'}");
{rdelim}
else if ( form.payment_method[2].checked == true )
{ldelim}
{rdelim}
else if ( form.payment_method[3].checked == true )
{ldelim}
{rdelim}
else
{ldelim}
alert( "{lang mkey='signup_js_errors' skey='select_payment'}" );
return false;
{rdelim}

result="";
if( ErrorCount > 0)
{ldelim}
alert(ErrorMsg[1]);
return false;
{rdelim}
return true;
{rdelim}
/* ]]> */
</script>

« Last Edit: December 22, 2017, 10:50:58 PM by Pharg »
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.1.15 | MySQL: 5.5.35

Re: Possible bug in payment.tpl
« Reply #4 on: December 23, 2017, 12:37:08 AM »
Yes, this was in the payments.tpl
PHPStorm, MAMP Pro, Sequel Pro
Currently converting my 2.1.6 site to osDateEvo 1.2

*

Pharg

  • *****
  • 3,069
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Possible bug in payment.tpl
« Reply #5 on: December 23, 2017, 12:45:20 AM »
Hi arievaul,

I found the elseif has always been like that in all the old osdate versions also, so that bug has been there for a very long time.

Thanks for pointing it out.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.1.15 | MySQL: 5.5.35