[repo.ue] UPDATE now can have empty 'bind_param' because can only set defaultFormation to NULL
This commit is contained in:
parent
6601880436
commit
6de03a80e3
|
@ -69,7 +69,7 @@ class ue extends Repo_i {
|
|||
* @volumeTD<float> [OPT] The UE's new volume of TD
|
||||
* @volumeTP<float> [OPT] The UE's new volume of TP
|
||||
* @disabled<bool> [OPT] Whether the UE is disabled
|
||||
* @defaultFormation<int> [OPT] The default formation foreign key
|
||||
* @defaultFormation<int> [OPT] The default formation foreign key (-1 to unset)
|
||||
*
|
||||
* @return updated<bool> Whether the update have been successful
|
||||
*
|
||||
|
@ -86,10 +86,20 @@ class ue extends Repo_i {
|
|||
if( !is_null($volumeTD) ){ $build_rq[] = '`volumeTD` = :volumeTD'; $bind_param[':volumeTD'] = $volumeTD; }
|
||||
if( !is_null($volumeTP) ){ $build_rq[] = '`volumeTP` = :volumeTP'; $bind_param[':volumeTP'] = $volumeTP; }
|
||||
if( !is_null($disabled) ){ $build_rq[] = '`disabled` = :disabled'; $bind_param[':disabled'] = $disabled?1:0; }
|
||||
if( !is_null($defaultFormation) ){ $build_rq[] = '`Formation_idFormation` = :defaultFormation'; $bind_param[':defaultFormation'] = $defaultFormation; }
|
||||
|
||||
// not null @defaultFormation -> set it
|
||||
if( !is_null($defaultFormation) ){
|
||||
|
||||
// if @defaultFormation is (-1) -> unset
|
||||
if( $defaultFormation < 0 ){ $build_rq[] = '`Formation_idFormation` = NULL'; }
|
||||
// else -> set to new value
|
||||
else{ $build_rq[] = '`Formation_idFormation` = :defaultFormation'; $bind_param[':defaultFormation'] = $defaultFormation; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (2) ERROR if no updated field */
|
||||
if( count($build_rq) <= 0 || count($bind_param) <= 1 )
|
||||
if( count($build_rq) <= 0 )
|
||||
return FALSE;
|
||||
|
||||
/* (3) Build request */
|
||||
|
|
Loading…
Reference in New Issue