axos88 / rainloop-plugin-vacation-settings-tab

MIT License
0 stars 2 forks source link

incorrect select values #3

Open ftoledo opened 8 years ago

ftoledo commented 8 years ago

i already use postixadmin with the follow vacation table structure:

 CREATE TABLE `vacation` (
  `email` varchar(255) NOT NULL,
  `subject` varchar(255) CHARACTER SET utf8 NOT NULL,
  `body` text CHARACTER SET utf8 NOT NULL,
  `activefrom` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00',
  `activeuntil` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00',
  `cache` text NOT NULL,
  `domain` varchar(255) NOT NULL,
  `interval_time` int(11) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `active` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`email`),
  KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Postfix Admin - Virtual Vacation' 

my config have this querys:

; RainLoop Webmail plugin (vacation-settings-tab)

[plugin]
dbtype = "mysql"
dbhost = "localhost"
dbport = 0
dbuser = "**********BUUU"
dbpass = "***************BUUU"
dbname = "postfix"
dbupdatequery = "UPDATE vacation SET active=:active, subject=:subject, body=:body, activefrom=:date_start, activeuntil=date_add(:date_end, INTERVAL 1439 MINUTE), modified=now() WHERE email=:email AND domain=:domain"
dbinsertquery = "INSERT INTO vacation(active, email, domain,interval_time,created) VALUES (0, :email,:domain,604800,now())"
dbselectquery = "SELECT active, subject, body, date_format(activefrom,'%Y-%m-%d') as date_start, date_format(activeuntil,'%Y-%m-%d') as date_end FROM vacation WHERE email=:email AND domain=:domain"
allowed_emails = "*"

when load the user setting tab , i have 2 issues: 1) the active checkbox always show as checked (but the database value is 0) 2) the date interval values are incorrect: database values: activefrom: 2015-12-12 00:00:00 activeuntil: 2015-12-15 23:59:59 showed values in the tab settings: 2015 12 11 2015 12 14

maybe must i fix my select query to get better format as expect the plugin? thanks!

ftoledo commented 8 years ago

the active field issue i was solved with select if(active=1,1,'') as active but still have dates formats issues

axos88 commented 8 years ago

huh. must be a timezone issue, i will take a better look at it

ftoledo commented 8 years ago

Can be, i will try to do a better debug. My server have UTC-3 timezone and the datetime sems to be correct. thanks