| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | class SH4_App_Command implements SH4_App_ICommand |
| 23 | 23 | { |
| 24 | - public $self, $crudFactory, $settings, $shiftTypesCommand, $calendarsCommand, $employeesCommand, $shiftsCommand; | |
| 24 | + public $crudFactory, $settings, $shiftTypesCommand, $calendarsCommand, $employeesCommand, $shiftsCommand; | |
| 25 | 25 | |
| 26 | 26 | public function __construct( |
| 27 | 27 | HC3_CrudFactory $crudFactory, |
| 28 | 28 | HC3_Settings $settings, |
| @@ -39,9 +39,8 @@ | ||
| 39 | 39 | $this->shiftTypesCommand = $hooks->wrap( $shiftTypesCommand ); |
| 40 | 40 | $this->calendarsCommand = $hooks->wrap( $calendarsCommand ); |
| 41 | 41 | $this->employeesCommand = $hooks->wrap( $employeesCommand ); |
| 42 | 42 | $this->shiftsCommand = $hooks->wrap( $shiftsCommand ); |
| 43 | - $this->self = $hooks->wrap( $this ); | |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | public function uninstall() |
| 47 | 46 | { |
| @@ -187,14 +186,16 @@ | ||
| 187 | 186 | |
| 188 | 187 | $this->settings->set( $settingName, $employeesIds ); |
| 189 | 188 | } |
| 190 | 189 | |
| 191 | - public function linkEmployeeToUserById( $employeeId, $userId ) | |
| 190 | + public function linkEmployeeToUser( SH4_Employees_Model $employee, HC3_Users_Model $user ) | |
| 192 | 191 | { |
| 192 | + $employeeId = $employee->getId(); | |
| 193 | 193 | if( ! $employeeId ){ |
| 194 | 194 | return; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | + $userId = $user->getId(); | |
| 197 | 198 | if( ! $userId ){ |
| 198 | 199 | return; |
| 199 | 200 | } |
| 200 | 201 | |
| @@ -201,13 +202,8 @@ | ||
| 201 | 202 | $crud = $this->crudFactory->make('employee'); |
| 202 | 203 | |
| 203 | 204 | $values = array( 'user_id' => $userId ); |
| 204 | 205 | $results = $crud->update( $employeeId, $values ); |
| 205 | - } | |
| 206 | - | |
| 207 | - public function linkEmployeeToUser( SH4_Employees_Model $employee, HC3_Users_Model $user ) | |
| 208 | - { | |
| 209 | - return $this->self->linkEmployeeToUserById( $employee->getId(), $user->getId() ); | |
| 210 | 206 | } |
| 211 | 207 | |
| 212 | 208 | public function unlinkEmployeeFromUser( SH4_Employees_Model $employee ) |
| 213 | 209 | { |