Index: trunk/extensions/EducationProgram/includes/EPRevisionedObject.php |
— | — | @@ -82,9 +82,8 @@ |
83 | 83 | * |
84 | 84 | * @return boolean Success indicator |
85 | 85 | */ |
86 | | - protected function storeRevision( EPRevisionedObject $revision, $isDelete = false ) { |
| 86 | + protected function storeRevision( EPRevision $revision, $isDelete = false ) { |
87 | 87 | if ( $this->storeRevisions ) { |
88 | | - $revison->setStoreRevisions( false ); |
89 | 88 | return $revison->save(); |
90 | 89 | } |
91 | 90 | |
— | — | @@ -121,7 +120,7 @@ |
122 | 121 | $revison = static::selectRow( null, array( 'id' => $this->getId() ) ); |
123 | 122 | static::setReadDb( DB_SLAVE ); |
124 | 123 | |
125 | | - return EPRevision::newFromObject( $revison, $isDelete );; |
| 124 | + return EPRevision::newFromObject( $revison ); |
126 | 125 | } |
127 | 126 | |
128 | 127 | /** |
— | — | @@ -156,7 +155,7 @@ |
157 | 156 | if ( $success && !$this->inSummaryMode ) { |
158 | 157 | $revision = $this->getCurrentRevision(); |
159 | 158 | |
160 | | - if ( $this->fieldsChanged( $revision, true ) ) { |
| 159 | + if ( $this->fieldsChanged( $revision->getObject(), true ) ) { |
161 | 160 | $this->storeRevision( $revision ); |
162 | 161 | $this->log( 'update' ); |
163 | 162 | } |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -293,7 +293,7 @@ |
294 | 294 | } |
295 | 295 | |
296 | 296 | if ( count( $currentFields ) > 0 ) { |
297 | | - $currentFields = self::selectFieldsRow( $currentFields, array( 'id' => $this->getId() ) ); |
| 297 | + $currentFields = self::selectFieldsRow( $currentFields, array( 'id' => $this->getId() ), array(), array(), false ); |
298 | 298 | } |
299 | 299 | } |
300 | 300 | |
— | — | @@ -309,7 +309,24 @@ |
310 | 310 | $field = $ambs === 'oas' ? 'online_ambs' : 'campus_ambs'; |
311 | 311 | |
312 | 312 | if ( array_key_exists( $field, $currentFields ) && $currentFields[$field] !== $this->getField( $field ) ) { |
313 | | - // TODO |
| 313 | + $courseField = $ambs === 'oas' ? 'opc_course_id' : 'cpc_course_id'; |
| 314 | + $userField = $ambs === 'oas' ? 'opc_oa_id' : 'cpc_ca_id'; |
| 315 | + $table = 'ep_' . $ambs . '_per_course'; |
| 316 | + |
| 317 | + $dbw = wfGetDB( DB_MASTER ); |
| 318 | + |
| 319 | + $dbw->delete( $table, array( $courseField => $id ) ); |
| 320 | + |
| 321 | + $dbw->begin(); |
| 322 | + |
| 323 | + foreach ( $this->getField( $field ) as $userId ) { |
| 324 | + $dbw->insert( $table, array( |
| 325 | + $courseField => $this->getId(), |
| 326 | + $userField => $userId |
| 327 | + ) ); |
| 328 | + } |
| 329 | + |
| 330 | + $dbw->commit(); |
314 | 331 | } |
315 | 332 | } |
316 | 333 | } |