Skip to content

Commit

Permalink
disable the locks when trying to copy records
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed May 25, 2012
1 parent c8357aa commit aa9ba4c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Core/Locks/Controller/Component/LockerComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@

class LockerComponent extends InfinitasComponent {
public function initialize($Controller){
$disable = !strstr($Controller->action, 'admin');
$disable = !strstr($Controller->action, 'admin') &&
!empty($Controller->uses) &&
isset($Controller->{$Controller->modelClass}->Behaviors);

if($disable && !empty($Controller->uses) && isset($Controller->{$Controller->modelClass}->Behaviors)){
$Controller->{$Controller->modelClass}->Behaviors->detach('Locks.Lockable');
$disable = $disable || (!empty($Controller->request->data['action']) && $Controller->request->data['action'] == 'copy');
if($disable){
$Controller->{$Controller->modelClass}->Behaviors->detach('Lockable');
}

return true;
Expand Down

0 comments on commit aa9ba4c

Please sign in to comment.