Merge remote-tracking branch 'svnexport/master'

pull/2/head
David Goodwin 11 years ago
commit d89475c39e

@ -321,9 +321,14 @@ sub get_interval {
sub already_notified {
my ($to, $from) = @_;
my $logger = get_logger();
my $query;
# delete old notifications
my $query = qq{DELETE vacation_notification.* FROM vacation_notification LEFT JOIN vacation ON vacation.email = vacation_notification.on_vacation WHERE on_vacation = ? AND notified = ? AND notified_at < vacation.activefrom};
if ($db_type eq 'Pg') {
$query = qq{DELETE FROM vacation_notification USING vacation WHERE vacation.email = vacation_notification.on_vacation AND on_vacation = ? AND notified = ? AND notified_at < vacation.activefrom;};
} else { # mysql
$query = qq{DELETE vacation_notification.* FROM vacation_notification LEFT JOIN vacation ON vacation.email = vacation_notification.on_vacation WHERE on_vacation = ? AND notified = ? AND notified_at < vacation.activefrom};
}
my $stm = $dbh->prepare($query);
if (!$stm) {
$logger->error("Could not prepare query (trying to delete old vacation notifications) :'$query' to: $to, from:$from");
@ -353,7 +358,11 @@ sub already_notified {
$interval = get_interval($to);
if ($interval) {
$query = qq{SELECT NOW()-notified_at FROM vacation_notification WHERE on_vacation=? AND notified=?};
if ($db_type eq 'Pg') {
$query = qq{SELECT extract( epoch from (NOW()-notified_at))::int FROM vacation_notification WHERE on_vacation=? AND notified=?};
} else { # mysql
$query = qq{SELECT NOW()-notified_at FROM vacation_notification WHERE on_vacation=? AND notified=?};
}
$stm = $dbh->prepare($query) or panic_prepare($query);
$stm->execute($to,$from) or panic_execute($query,"on_vacation='$to', notified='$from'");
my @row = $stm->fetchrow_array;

@ -45,7 +45,7 @@ $formconf = $handler->webformConfig();
authentication_require_role($formconf['required_role']);
if ($edit != '' || $formconf['early_init']) {
if ($new == 0 || $formconf['early_init']) {
if (!$handler->init($edit)) {
if (count($handler->errormsg) == 0) {
# should never happen and indicates a bug in $handler->init()
@ -61,7 +61,7 @@ $form_fields = $handler->getStruct();
$id_field = $handler->getId_field();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
if ($edit == '') { # new - prefill fields from URL parameters if allowed in $formconf['prefill']
if ($new) { # new - prefill fields from URL parameters if allowed in $formconf['prefill']
if ( isset($formconf['prefill']) ) {
foreach ($formconf['prefill'] as $field) {
$prefillvalue = safeget($field, safesession("prefill:$table:$field"));
@ -116,7 +116,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (isset($formconf['hardcoded_edit']) && $formconf['hardcoded_edit']) {
$values[$id_field] = $form_fields[$id_field]['default'];
} elseif ($edit != "") {
} elseif ($new == 0) {
$values[$id_field] = $edit;
}
@ -159,7 +159,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
}
}
if ($edit != "") {
if ($new == 0) {
header ("Location: " . $formconf['listview']);
exit;
} else {

@ -1282,6 +1282,7 @@ function db_connect ($ignore_errors = 0) {
*/
function db_get_boolean($bool) {
if(! (is_bool($bool) || $bool == '0' || $bool == '1') ) {
error_log("Invalid usage of 'db_get_boolean($bool)'");
die("Invalid usage of 'db_get_boolean($bool)'");
}

@ -221,6 +221,10 @@ class AliasHandler extends PFAHandler {
} else {
$oldvalues = $old_ah->result();
if (!isset($values['goto'])) { # no new value given?
$values['goto'] = $oldvalues['goto'];
}
if (!isset($values['on_vacation'])) { # no new value given?
$values['on_vacation'] = $oldvalues['on_vacation'];
}

@ -61,6 +61,8 @@
<div class="quota quota_{$quota_level}" style="width:{$divide_quota.quota_width[$i]}px;"></div>
<div class="quota_bg"></div></div>
<div class="quota_text quota_text_{$quota_level}">{$divide_quota.current[$i]} / {$divide_quota.quota[$i]}</div>
{else}
{$divide_quota.quota[$i]}
{/if}
{/if}
</td>

Loading…
Cancel
Save