View Single Post
  #66  
Old 10-03-2011, 05:50 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: X-Cart v4.4.4 released

This is not new and it's been asked few times and still not fixed. When running the upgrade from admin the screen after the initial files check has this at the bottom

Quote:

Tick here to continue upgrading regardless of the found problems

which is checked by default. "Apply patch" and "Go back" buttons are too close to each other and one can easily hit the wrong button. Applying the patch when there are "could not patch" errors will result of not all files being patched and the database not patched as well. This should not be checked by default and the "Apply patch" button should be disabled unless box is checked.

For your own safety do this and keep it in there. Open "admin/main/patch_apply.tpl" and at the top of the file insert this

Code:
<script type="text/javascript"> //<![CDATA[ {literal} var agree_checkboxes = ['try_all']; function check_agree(form) { for (var i = 0; i < agree_checkboxes.length; i++) { var c = form.elements.namedItem(agree_checkboxes[i]); if (c && !c.checked) return false; } return true; } function patch_agree(o) { var valid = true; for (var i = 0; i < agree_checkboxes.length && valid; i++) { var c = o.form.elements.namedItem(agree_checkboxes[i]); if (c && !c.checked) valid = false; } $('input[name=submit]').button(valid ? 'enable' : 'disable') return true; } {/literal} //]]> </script>

then find

Code:
<form action="patch.php" method="post">

and replace with

Code:
<form action="patch.php" method="post" onsubmit="javascript: return check_agree(this);">

then find

Code:
<label for="try_all">{$lng.lbl_tick_here_to_apply_patch}</label><input type="checkbox" id="try_all" name="try_all" /><br />

and replace with

Code:
<label for="try_all">{$lng.lbl_tick_here_to_apply_patch}</label><input type="checkbox" id="try_all" name="try_all" onclick="javascript: patch_agree(this);" /><br />

then find

Code:
<input type="submit" value="{$lng.lbl_apply_patch|strip_tags:false|escape}" />

and replace with

Code:
<input type="submit" name="submit" value="{$lng.lbl_apply_patch|strip_tags:false|escape}"{if $could_not_patch ne "0" and $mode ne "sql"} disabled="disabled"{/if} />

Done.

Come on QT, this is your own code, just copy/paste, and you can't implement it to something as important as running a patch
__________________
Steve Stoyanov
CFLSystems.com
Web Development