VacationHandler.php:

- set_away() killed the existing aliases and replaced them with the vacation 
  alias instead of adding it. Fixed.
- remove array() from db_update calls for vacation table (introduced by valkum
  in r981) - the vacation table has created/modified columns since r945


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@988 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 14 years ago
parent 179f195bf1
commit c75022ad50

@ -24,14 +24,14 @@ class VacationHandler {
$new_aliases[] = $alias; $new_aliases[] = $alias;
} }
} }
$ah->update($new_aliases, '', false); $ah->update($new_aliases, '', false); # TODO: supress logging in AliasHandler if called from VacationHandler (VacationHandler should log itsself)
// tidy up vacation table. // tidy up vacation table.
$vacation_data = array( $vacation_data = array(
'active' => db_get_boolean(false), 'active' => db_get_boolean(false),
); );
$result = db_update('vacation', 'email', $this->username, $vacation_data, array()); $result = db_update('vacation', 'email', $this->username, $vacation_data);
$result = db_delete('vacation_notification', 'on_vacation', $this->username, array()); $result = db_delete('vacation_notification', 'on_vacation', $this->username);
# TODO db_log() call (maybe except if called from set_away?) # TODO db_log() call (maybe except if called from set_away?)
/* crap error handling; oh for exceptions... */ /* crap error handling; oh for exceptions... */
return true; return true;
@ -117,14 +117,15 @@ class VacationHandler {
$table_vacation = table_by_key('vacation'); $table_vacation = table_by_key('vacation');
$result = db_query("SELECT * FROM $table_vacation WHERE email = '$E_username'"); $result = db_query("SELECT * FROM $table_vacation WHERE email = '$E_username'");
if($result['rows'] == 1) { if($result['rows'] == 1) {
$result = db_update('vacation', 'email', $this->username, $vacation_data, array()); $result = db_update('vacation', 'email', $this->username, $vacation_data);
} else { } else {
$result = db_insert('vacation', $vacation_data, array()); $result = db_insert('vacation', $vacation_data);
} }
# TODO error check # TODO error check
# TODO wrap whole function in db_begin / db_commit (or rollback)? # TODO wrap whole function in db_begin / db_commit (or rollback)?
$ah = new AliasHandler($this->username); $ah = new AliasHandler($this->username);
$alias = $ah->get(true); $alias = $ah->get(true);
$aliases = $ah->return;
$vacation_address = $this->getVacationAlias(); $vacation_address = $this->getVacationAlias();
$aliases[] = $vacation_address; $aliases[] = $vacation_address;
return $ah->update($aliases, '', false); return $ah->update($aliases, '', false);

Loading…
Cancel
Save