diff -ubBrN com2/comas/examples/templates/icgtmp/attendees/new.tmpl com3/comas/examples/templates/icgtmp/attendees/new.tmpl
--- com2/comas/examples/templates/icgtmp/attendees/new.tmpl 2005-08-05 09:12:57.000000000 +0300
+++ com3/comas/examples/templates/icgtmp/attendees/new.tmpl 2005-08-05 17:47:03.000000000 +0300
@@ -2,6 +2,8 @@
New account registration
+
+
+
+The registration period has expired. If you want to be considered for late registration please write to the organizing committee directly.
+
+
diff -ubBrN com2/comas/perl/Comas/Conf.pm com3/comas/perl/Comas/Conf.pm
--- com2/comas/perl/Comas/Conf.pm 2005-08-05 09:12:58.000000000 +0300
+++ com3/comas/perl/Comas/Conf.pm 2005-08-05 17:43:36.000000000 +0300
@@ -122,6 +122,8 @@
B: 1980-01-01 00:00
+B: 1980-01-01 00:00
+
B: localhost
B: 5
@@ -268,6 +270,7 @@
'max_authors_x_proposal' => ['The limit of authors per proposal', '0'],
'max_proposals_x_person' => ['The limit of proposals per person','0'],
'proposals_new_max_date' => ['The last date for sending a proposal, the format is YYYY-MM-DD HH:MM (in 24 hours style)', '1980-01-01 00:00'],
+ 'registrations_new_max_date' => ['The last date for registering, the format is YYYY-MM-DD HH:MM (in 24 hours style)', '1980-01-01 00:00'],
'priv_person_types' => ['The privileged person types (an administrator should set this in a person), separated by ,', '4'],
'proposal_modif_mail_from' => ['Address with which to send the mail to the academic committee when the proposal is modified by the author', 'comas@localhost.localdomain'],
'smtp_host' => ['SMTP server', 'localhost'],
diff -ubBrN com2/comas/perl/Comas/HTML/attendees.pm com3/comas/perl/Comas/HTML/attendees.pm
--- com2/comas/perl/Comas/HTML/attendees.pm 2005-08-05 09:12:59.000000000 +0300
+++ com3/comas/perl/Comas/HTML/attendees.pm 2005-08-05 17:45:53.000000000 +0300
@@ -176,6 +176,12 @@
);
$template->param($h->{-params});
+ if (Comas::Person->days_left_for_registration(-db=>$h->{-db}) <= 0) {
+ $template->param(-allow_registrations => 0);
+ } else {
+ $template->param(-allow_registrations => 1);
+ }
+
return $template->output;
}
diff -ubBrN com2/comas/perl/Comas/Person.pm com3/comas/perl/Comas/Person.pm
--- com2/comas/perl/Comas/Person.pm 2005-08-05 09:12:58.000000000 +0300
+++ com3/comas/perl/Comas/Person.pm 2005-08-05 17:44:40.000000000 +0300
@@ -824,6 +824,28 @@
return $ret;
}
+sub days_left_for_registration {
+ my ($p, $db, $sth);
+ $p = shift;
+
+ if (ref $p) {
+ $db = $p->{-db};
+ } elsif ($p eq '-db' or shift eq '-db') {
+ $db = shift;
+ } else {
+ carp 'Invocation error';
+ return undef;
+ }
+
+ unless ($sth = $db->prepare('SELECT days_for_new_registrations()') and
+ $sth->execute) {
+ carp 'Could not execute query: ', $db->lastMsg;
+ return undef;
+ }
+
+ return $sth->fetchrow_array;
+}
+
1;
diff -ubBrN com2/comas/sql/functions.sql com3/comas/sql/functions.sql
--- com2/comas/sql/functions.sql 2005-08-05 09:12:59.000000000 +0300
+++ com3/comas/sql/functions.sql 2005-08-05 17:42:48.000000000 +0300
@@ -444,6 +444,26 @@
LANGUAGE 'plpgsql';
-- #############################################################################
+-- days_for_new_registrations
+-- Returns the number of days (including the last day) users still have for
+-- registering for the conference. If the period for registrations is over,
+-- it will return a negative value.
+-- Note that this is good only for getting the number of DAYS - it does not take
+-- into account the hour. 0 means that today is the last day, but does not show
+-- if the period is closed or open.
+CREATE OR REPLACE FUNCTION days_for_new_registrations () returns integer AS
+'DECLARE
+ max_date date;
+BEGIN
+ -- We handle max_date and cast now() to a date in order to get the
+ -- number of days as an integer and avoid jumping through hoops.
+ SELECT INTO max_date value::date FROM config WHERE
+ name = ''registrations_new_max_date'';
+ RETURN max_date - now()::date;
+END;'
+LANGUAGE 'plpgsql';
+
+-- #############################################################################
-- lock_proposals_before_accepted
-- Dont't update a proposal if it have been acepted, unless the change is
-- limited to changing the proposal's status or rescheduling it (either