Merge commit 'v7.10.24' into WebGUI8
This commit is contained in:
commit
3b418ede3c
139 changed files with 699 additions and 32133 deletions
|
|
@ -1126,7 +1126,7 @@ sub viewList {
|
|||
);
|
||||
|
||||
### Build the event vars
|
||||
my $dtLast = $dtStart; # The DateTime of the last event
|
||||
my $dtLast = WebGUI::DateTime->new(0); # The DateTime of the last event
|
||||
EVENT: for my $event (@events) {
|
||||
next EVENT unless $event && $event->canView();
|
||||
my ( %eventVar, %eventDate )
|
||||
|
|
@ -1135,12 +1135,15 @@ sub viewList {
|
|||
# Add the change flags
|
||||
my $dt = $event->getDateTimeStart;
|
||||
if ( $dt->year > $dtLast->year ) {
|
||||
$eventVar{ new_year } = 1;
|
||||
}
|
||||
if ( $dt->month > $dtLast->month ) {
|
||||
$eventVar{ new_year } = 1;
|
||||
$eventVar{ new_month } = 1;
|
||||
$eventVar{ new_day } = 1;
|
||||
}
|
||||
if ( $dt->day > $dtLast->day ) {
|
||||
elsif ( $dt->month > $dtLast->month ) {
|
||||
$eventVar{ new_month } = 1;
|
||||
$eventVar{ new_day } = 1;
|
||||
}
|
||||
elsif ( $dt->day > $dtLast->day ) {
|
||||
$eventVar{ new_day } = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2430,6 +2430,53 @@ sub export {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 exportAssetData ()
|
||||
|
||||
Extend the base method to include custom question types added to this Survey.
|
||||
|
||||
=cut
|
||||
|
||||
sub exportAssetData {
|
||||
my $self = shift;
|
||||
my $asset_data = $self->SUPER::exportAssetData();
|
||||
my $questions = $self->surveyJSON->questions();
|
||||
my $multiple_choice = $self->surveyJSON->multipleChoiceTypes();
|
||||
my %question_types = ();
|
||||
my $get_question = $self->session->db->prepare('select answers from Survey_questionTypes where questionType=?');
|
||||
foreach my $question (@{ $questions }) {
|
||||
my $type = $question->{questionType};
|
||||
next unless $multiple_choice->{$type};
|
||||
next if $question_types{$type};
|
||||
$get_question->execute([$type]);
|
||||
my ($answers) = $get_question->array();
|
||||
$question_types{$type} = $answers;
|
||||
}
|
||||
#my $question_types = $self->db->buildArrayRefOfHashRefs('select * from Survey_questionTypes');
|
||||
$get_question->finish;
|
||||
$asset_data->{question_types} = \%question_types;
|
||||
return $asset_data;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 importAssetCollateralData ($data)
|
||||
|
||||
Extend the base method to include custom question types added to this Survey.
|
||||
|
||||
=cut
|
||||
|
||||
sub importAssetCollateralData {
|
||||
my $self = shift;
|
||||
my $data = shift;
|
||||
$self->SUPER::importAssetCollateralData($data);
|
||||
my $custom_types = $data->{question_types};
|
||||
while (my ($question, $answer) = each %{ $custom_types }) {
|
||||
$self->session->db->write("INSERT INTO Survey_questionTypes VALUES(?,?) ON DUPLICATE KEY UPDATE answers = ?",[$question,$answer,$answer]);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_exportSimpleResults ()
|
||||
|
||||
Exports transposed results as CSV (or tabbed depending on the C<format> form param)
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ sub addType {
|
|||
my $questionType = shift;
|
||||
my $address = shift;
|
||||
my $question = $self->question($address);
|
||||
my $ansString = $question->{answers} ? to_json $question->{answers} : {};
|
||||
my $ansString = $question->{answers} ? to_json $question->{answers} : '{}';
|
||||
$self->session->db->write("INSERT INTO Survey_questionTypes VALUES(?,?) ON DUPLICATE KEY UPDATE answers = ?",[$questionType,$ansString,$ansString]);
|
||||
$question->{questionType} = $questionType;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue