// Removing numerics from order reference

This commit is contained in:
mDeflotte
2011-12-06 13:18:00 +00:00
parent 18ff7dbed1
commit 2bf4ef9196
4 changed files with 26 additions and 7 deletions
+15 -2
View File
@@ -35,11 +35,24 @@ class ToolsCore
* Random password generator
*
* @param integer $length Desired length (optional)
* @param string $flag Output type (NUMERIC, ALPHANUMERIC, NO_NUMERIC)
* @return string Password
*/
public static function passwdGen($length = 8)
public static function passwdGen($length = 8, $flag = 'ALPHANUMERIC')
{
$str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
switch ($flag)
{
case 'NUMERIC':
$str = '0123456789';
break;
case 'NO_NUMERIC':
$str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
default:
$str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
}
for ($i = 0, $passwd = ''; $i < $length; $i++)
$passwd .= self::substr($str, mt_rand(0, self::strlen($str) - 1), 1);
return $passwd;
+1 -3
View File
@@ -1292,9 +1292,7 @@ class OrderCore extends ObjectModel
*/
public static function generateReference()
{
// To generate a random reference, we first generate a random number
// This number is a rand concated with the current timestamp
return strtoupper(Tools::passwdGen(9)); // lol Max !
return strtoupper(Tools::passwdGen(9, 'NO_NUMERIC'));
}
public function orderContainProduct($id_product)
+5 -2
View File
@@ -32,8 +32,11 @@
<br /><br />- {l s='to the account owner of' mod='bankwire'} <span class="bold">{if $bankwireOwner}{$bankwireOwner}{else}___________{/if}</span>
<br /><br />- {l s='with these details' mod='bankwire'} <span class="bold">{if $bankwireDetails}{$bankwireDetails}{else}___________{/if}</span>
<br /><br />- {l s='to this bank' mod='bankwire'} <span class="bold">{if $bankwireAddress}{$bankwireAddress}{else}___________{/if}</span>
<br /><br />- {l s='Do not forget to insert your order #' mod='bankwire'} <span class="bold">{$id_order}</span> {l s='in the subject of your bank wire' mod='bankwire'}
<br /><br />{l s='An e-mail has been sent to you with this information.' mod='bankwire'}
{if !isset($reference)}
<br /><br />- {l s='Do not forget to insert your order number #' mod='bankwire'} <span class="bold">{$id_order}</span> {l s='in the subject of your bank wire' mod='bankwire'}
{else}
<br /><br />- {l s='Do not forget to insert your order reference' mod='bankwire'} <span class="bold">{$reference}</span> {l s='in the subject of your bank wire' mod='bankwire'}
{/if} <br /><br />{l s='An e-mail has been sent to you with this information.' mod='bankwire'}
<br /><br /><span class="bold">{l s='Your order will be sent as soon as we receive your settlement.' mod='bankwire'}</span>
<br /><br />{l s='For any questions or for further information, please contact our' mod='bankwire'} <a href="{$link->getPageLink('contact', true)}">{l s='customer support' mod='bankwire'}</a>.
</p>
+5
View File
@@ -31,6 +31,11 @@
<br /><br />- {l s='an amount of' mod='cheque'} <span class="price">{$total_to_pay}</span>
<br /><br />- {l s='payable to the order of' mod='cheque'} <span class="bold">{if $chequeName}{$chequeName}{else}___________{/if}</span>
<br /><br />- {l s='mail to' mod='cheque'} <span class="bold">{if $chequeAddress}{$chequeAddress}{else}___________{/if}</span>
{if !isset($reference)}
<br /><br />- {l s='Do not forget to insert your order number #' mod='cheque'} <span class="bold">{$id_order}</span>
{else}
<br /><br />- {l s='Do not forget to insert your order reference' mod='cheque'} <span class="bold">{$reference}</span>
{/if}
<br /><br />{l s='An e-mail has been sent to you with this information.' mod='cheque'}
<br /><br /><span class="bold">{l s='Your order will be sent as soon as we receive your payment.' mod='cheque'}</span>
<br /><br />{l s='For any questions or for further information, please contact our' mod='cheque'} <a href="{$link->getPageLink('contact', true)}">{l s='customer support' mod='cheque'}</a>.