Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -119,7 +119,7 @@ class _Coupon extends \IPS\Node\Model
|
||||
|
||||
$form->addHeader( 'coupon_basic_settings' );
|
||||
$id = $this->id ?: NULL;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'c_code', $this->id ? $this->code : mb_strtoupper( mb_substr( md5( uniqid() ), 0, 5 ) ), TRUE, array( 'maxLength' => 25 ), function( $val ) use ( $id )
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'c_code', $this->id ? $this->code : mb_strtoupper( mb_substr( md5( mt_rand() ), 0, 5 ) ), TRUE, array( 'maxLength' => 25 ), function( $val ) use ( $id )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -428,4 +428,23 @@ class _Coupon extends \IPS\Node\Model
|
||||
$item->extra['items'] = $items;
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* [ActiveRecord] Duplicate
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
if ( $this->skipCloneDuplication === TRUE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
parent::__clone();
|
||||
|
||||
$this->code = mb_strtoupper( mb_substr( md5( mt_rand() ), 0, 5 ) );
|
||||
$this->used_by = array();
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user