forked from Wavyzz/dolibarr
New: Improved Opensurvey module: Description of survey use wysiwig
editor, More information shown on result tab, Renamed "survey" into "poll" (better translation).
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -17,8 +17,13 @@ For users:
|
|||||||
- New: Add option MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES and MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES
|
- New: Add option MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES and MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES
|
||||||
to automatically add timestamp and user line into edition field when editing a note.
|
to automatically add timestamp and user line into edition field when editing a note.
|
||||||
- New: Add button cancel into edition of notes.
|
- New: Add button cancel into edition of notes.
|
||||||
- New: Improved Opensurvey module and added options to disable comments and disable
|
- New: Improved Opensurvey module:
|
||||||
public votes.
|
Added options to disable comments and disable public votes.
|
||||||
|
Limit dates use calendar popup.
|
||||||
|
Description of survey use wysiwig editor.
|
||||||
|
More information shown on result tab.
|
||||||
|
Renamed "survey" into "poll" (better translation).
|
||||||
|
- New: Add filter on text and status into survey list. Can also sort on id, text and date end.
|
||||||
- New: The box "balance of bank accounts" show all opened accounts.
|
- New: The box "balance of bank accounts" show all opened accounts.
|
||||||
- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale represnative into public
|
- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale represnative into public
|
||||||
note of generated documents.
|
note of generated documents.
|
||||||
@@ -26,7 +31,6 @@ For users:
|
|||||||
- New: Increase length of url into bookmark module.
|
- New: Increase length of url into bookmark module.
|
||||||
- New: Automatic events sending mails add info about linked objects into email content.
|
- New: Automatic events sending mails add info about linked objects into email content.
|
||||||
- New: Price management enhancement (multiprice level, price by customer, if MAIN_FEATURES_LEVEL=2 Price by qty).
|
- New: Price management enhancement (multiprice level, price by customer, if MAIN_FEATURES_LEVEL=2 Price by qty).
|
||||||
- New: Add filter on text and status into survey list. Can also sort on id, text and date end.
|
|
||||||
- New: Add option MAIN_FAVICON_URL.
|
- New: Add option MAIN_FAVICON_URL.
|
||||||
- New: Created {line_price_ht_locale}, {line_price_vat_locale} and {line_price_ttc_locale} ODT tags.
|
- New: Created {line_price_ht_locale}, {line_price_vat_locale} and {line_price_ttc_locale} ODT tags.
|
||||||
- New: Add filter on project status into task list. By default, only "opened" project are visible.
|
- New: Add filter on project status into task list. By default, only "opened" project are visible.
|
||||||
|
|||||||
@@ -999,7 +999,7 @@ function dol_getdate($timestamp,$fast=false)
|
|||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
||||||
* @param int $check 0=No check on parameters (Can use day 32, etc...)
|
* @param int $check 0=No check on parameters (Can use day 32, etc...)
|
||||||
* @return int Date as a timestamp, '' if error
|
* @return int Date as a timestamp, '' if error
|
||||||
* @see dol_print_date, dol_stringtotime, dol_getdate
|
* @see dol_print_date, dol_stringtotime, dol_getdate
|
||||||
*/
|
*/
|
||||||
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||||
|
|||||||
@@ -512,8 +512,8 @@ Module50200Name= Paypal
|
|||||||
Module50200Desc= Module to offer an online payment page by credit card with Paypal
|
Module50200Desc= Module to offer an online payment page by credit card with Paypal
|
||||||
Module54000Name=PrintIPP
|
Module54000Name=PrintIPP
|
||||||
Module54000Desc=Print via Cups IPP Printer.
|
Module54000Desc=Print via Cups IPP Printer.
|
||||||
Module55000Name=Open Survey
|
Module55000Name=Open Poll
|
||||||
Module55000Desc=Module to make online surveys (like Doodle, Studs, Rdvz, ...)
|
Module55000Desc=Module to make online polls (like Doodle, Studs, Rdvz, ...)
|
||||||
Module59000Name=Margins
|
Module59000Name=Margins
|
||||||
Module59000Desc=Module to manage margins
|
Module59000Desc=Module to manage margins
|
||||||
Module60000Name=Commissions
|
Module60000Name=Commissions
|
||||||
@@ -732,8 +732,8 @@ Permission50101=Use Point of sales
|
|||||||
Permission50201=Read transactions
|
Permission50201=Read transactions
|
||||||
Permission50202=Import transactions
|
Permission50202=Import transactions
|
||||||
Permission54001=Print
|
Permission54001=Print
|
||||||
Permission55001=Read surveys
|
Permission55001=Read polls
|
||||||
Permission55002=Create/modify surveys
|
Permission55002=Create/modify polls
|
||||||
Permission59001=Read commercial margins
|
Permission59001=Read commercial margins
|
||||||
Permission59002=Define commercial margins
|
Permission59002=Define commercial margins
|
||||||
DictionaryCompanyType=Thirdparties type
|
DictionaryCompanyType=Thirdparties type
|
||||||
|
|||||||
@@ -225,8 +225,6 @@ DispenseMontantLettres=The written invoices through mecanographic procedures are
|
|||||||
NonPercuRecuperable=Non-recoverable
|
NonPercuRecuperable=Non-recoverable
|
||||||
SetConditions=Set payment terms
|
SetConditions=Set payment terms
|
||||||
SetMode=Set payment mode
|
SetMode=Set payment mode
|
||||||
SetDate= Set date
|
|
||||||
SelectDate=Select a date
|
|
||||||
Billed=Billed
|
Billed=Billed
|
||||||
RepeatableInvoice=Pre-defined invoice
|
RepeatableInvoice=Pre-defined invoice
|
||||||
RepeatableInvoices=Pre-defined invoices
|
RepeatableInvoices=Pre-defined invoices
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ ErrorNoSocialContributionForSellerCountry=Error, no social contribution type def
|
|||||||
ErrorFailedToSaveFile=Error, failed to save file.
|
ErrorFailedToSaveFile=Error, failed to save file.
|
||||||
ErrorOnlyPngJpgSupported=Error, only .png and .jpg image format file are supported.
|
ErrorOnlyPngJpgSupported=Error, only .png and .jpg image format file are supported.
|
||||||
ErrorImageFormatNotSupported=Your PHP does not support functions to convert images of this format.
|
ErrorImageFormatNotSupported=Your PHP does not support functions to convert images of this format.
|
||||||
|
SetDate=Set date
|
||||||
|
SelectDate=Select a date
|
||||||
SeeAlso=See also %s
|
SeeAlso=See also %s
|
||||||
BackgroundColorByDefault=Default background color
|
BackgroundColorByDefault=Default background color
|
||||||
FileWasNotUploaded=A file is selected for attachment but was not yet uploaded. Click on "Attach file" for this.
|
FileWasNotUploaded=A file is selected for attachment but was not yet uploaded. Click on "Attach file" for this.
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
# Dolibarr language file - Source file is en_US - opensurvey
|
# Dolibarr language file - Source file is en_US - opensurvey
|
||||||
Survey=Survey
|
Survey=Poll
|
||||||
Surveys=Surveys
|
Surveys=Polls
|
||||||
OrganizeYourMeetingEasily=Organize your meetings and surveys easily. First select type of survey...
|
OrganizeYourMeetingEasily=Organize your meetings and polls easily. First select type of poll...
|
||||||
NewSurvey=New survey
|
NewSurvey=New poll
|
||||||
NoSurveysInDatabase=%s survey(s) into database.
|
NoSurveysInDatabase=%s poll(s) into database.
|
||||||
OpenSurveyArea=Surveys area
|
OpenSurveyArea=Polls area
|
||||||
AddACommentForPoll=You can add a comment into survey...
|
AddACommentForPoll=You can add a comment into poll...
|
||||||
AddComment=Add comment
|
AddComment=Add comment
|
||||||
CreatePoll=Create poll
|
CreatePoll=Create poll
|
||||||
PollTitle=Poll title
|
PollTitle=Poll title
|
||||||
ToReceiveEMailForEachVote=To receive an email for each vote
|
ToReceiveEMailForEachVote=Receive an email for each vote
|
||||||
TypeDate=Type date
|
TypeDate=Type date
|
||||||
TypeClassic=Type standard
|
TypeClassic=Type standard
|
||||||
OpenSurveyStep2=Select your dates amoung the free days (green). The selected days are in blue. You can unselect a day previously selected by clicking again on it
|
OpenSurveyStep2=Select your dates amoung the free days (grey). The selected days are green. You can unselect a day previously selected by clicking again on it
|
||||||
RemoveAllDays=Remove all days
|
RemoveAllDays=Remove all days
|
||||||
CopyHoursOfFirstDay=Copy hours of first day
|
CopyHoursOfFirstDay=Copy hours of first day
|
||||||
RemoveAllHours=Remove all hours
|
RemoveAllHours=Remove all hours
|
||||||
@@ -24,10 +24,10 @@ OpenSurveyHowTo=If you agree to vote in this poll, you have to give your name, c
|
|||||||
CommentsOfVoters=Comments of voters
|
CommentsOfVoters=Comments of voters
|
||||||
ConfirmRemovalOfPoll=Are you sure you want to remove this poll (and all votes)
|
ConfirmRemovalOfPoll=Are you sure you want to remove this poll (and all votes)
|
||||||
RemovePoll=Remove poll
|
RemovePoll=Remove poll
|
||||||
UrlForSurvey=URL to communicate to get a direct access to survey
|
UrlForSurvey=URL to communicate to get a direct access to poll
|
||||||
PollOnChoice=You are creating a poll to make a multi-choice for a poll. First enter all possible choices for your poll:
|
PollOnChoice=You are creating a poll to make a multi-choice for a poll. First enter all possible choices for your poll:
|
||||||
CreateSurveyDate=Create a date survey
|
CreateSurveyDate=Create a date poll
|
||||||
CreateSurveyStandard=Create a standard survey
|
CreateSurveyStandard=Create a standard poll
|
||||||
CheckBox=Simple checkbox
|
CheckBox=Simple checkbox
|
||||||
YesNoList=List (empty/yes/no)
|
YesNoList=List (empty/yes/no)
|
||||||
PourContreList=List (empty/for/against)
|
PourContreList=List (empty/for/against)
|
||||||
@@ -35,7 +35,7 @@ AddNewColumn=Add new column
|
|||||||
TitleChoice=Choice label
|
TitleChoice=Choice label
|
||||||
ExportSpreadsheet=Export result spreadsheet
|
ExportSpreadsheet=Export result spreadsheet
|
||||||
ExpireDate=Limit date
|
ExpireDate=Limit date
|
||||||
NbOfSurveys=Number of surveys
|
NbOfSurveys=Number of polls
|
||||||
NbOfVoters=Nb of voters
|
NbOfVoters=Nb of voters
|
||||||
SurveyResults=Results
|
SurveyResults=Results
|
||||||
PollAdminDesc=You are allowed to change all vote lines of this poll with button "Edit". You can, as well, remove a column or a line with %s. You can also add a new column with %s.
|
PollAdminDesc=You are allowed to change all vote lines of this poll with button "Edit". You can, as well, remove a column or a line with %s. You can also add a new column with %s.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
require_once('../main.inc.php');
|
require_once('../main.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
|
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ if ($action == 'delete_confirm')
|
|||||||
{
|
{
|
||||||
// Security check
|
// Security check
|
||||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||||
|
|
||||||
$result=$object->delete($user,'',$numsondage);
|
$result=$object->delete($user,'',$numsondage);
|
||||||
|
|
||||||
header('Location: '.dol_buildpath('/opensurvey/list.php',1));
|
header('Location: '.dol_buildpath('/opensurvey/list.php',1));
|
||||||
@@ -127,7 +128,7 @@ if (GETPOST('ajoutcomment'))
|
|||||||
$comment_user = GETPOST('commentuser');
|
$comment_user = GETPOST('commentuser');
|
||||||
|
|
||||||
$resql = $object->addComment($comment, $comment_user);
|
$resql = $object->addComment($comment, $comment_user);
|
||||||
|
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorInsertingComment'), 'errors');
|
setEventMessage($langs->trans('ErrorInsertingComment'), 'errors');
|
||||||
@@ -141,12 +142,12 @@ if ($idcomment)
|
|||||||
{
|
{
|
||||||
// Security check
|
// Security check
|
||||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||||
|
|
||||||
$resql = $object->deleteComment($idcomment);
|
$resql = $object->deleteComment($idcomment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'edit') {
|
if ($action == 'edit') {
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||||
}
|
}
|
||||||
@@ -216,23 +217,22 @@ if ($action == 'edit')
|
|||||||
else print dol_htmlentities($object->titre);
|
else print dol_htmlentities($object->titre);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Author
|
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans("Author") .'</td><td colspan="2">';
|
|
||||||
if ($object->fk_user_creat) {
|
|
||||||
print $userstatic->getLoginUrl(1);
|
|
||||||
} else {
|
|
||||||
print dol_htmlentities($object->nom_admin);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<tr><td>'.$langs->trans("Description") .'</td><td colspan="2">';
|
print '<tr><td valign="top">'.$langs->trans("Description") .'</td><td colspan="2">';
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<textarea name="nouveauxcommentaires" rows="7" cols="80">'. dol_htmlentities($object->commentaires).'</textarea>'."\n";
|
$doleditor=new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120);
|
||||||
|
$doleditor->Create(0,'');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (empty($conf->fckeditor->enabled)) print dol_htmlentitiesbr($object->commentaires);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$doleditor=new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120,1);
|
||||||
|
$doleditor->Create(0,'');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else print dol_nl2br(dol_htmlentities($object->commentaires));
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// EMail
|
// EMail
|
||||||
@@ -255,7 +255,7 @@ if ($action == 'edit')
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print yn($object->mailsonde);
|
print yn($object->mailsonde);
|
||||||
|
|
||||||
//If option is active and linked user does not have an email, we show a warning
|
//If option is active and linked user does not have an email, we show a warning
|
||||||
if ($object->fk_user_creat && $object->mailsonde) {
|
if ($object->fk_user_creat && $object->mailsonde) {
|
||||||
if (!$userstatic->email) {
|
if (!$userstatic->email) {
|
||||||
@@ -289,6 +289,15 @@ if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object-
|
|||||||
else print dol_print_date($object->date_fin,'day');
|
else print dol_print_date($object->date_fin,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Author
|
||||||
|
print '<tr><td>';
|
||||||
|
print $langs->trans("Author") .'</td><td colspan="2">';
|
||||||
|
if ($object->fk_user_creat) {
|
||||||
|
print $userstatic->getLoginUrl(1);
|
||||||
|
} else {
|
||||||
|
print dol_htmlentities($object->nom_admin);
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Link
|
// Link
|
||||||
print '<tr><td>'.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').'</td><td colspan="2">';
|
print '<tr><td>'.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').'</td><td colspan="2">';
|
||||||
@@ -317,7 +326,7 @@ dol_fiche_end();
|
|||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($action != 'edit' && $user->rights->opensurvey->write) {
|
if ($action != 'edit' && $user->rights->opensurvey->write) {
|
||||||
|
|
||||||
//Modify button
|
//Modify button
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondage . '">'.$langs->trans("Modify") . '</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondage . '">'.$langs->trans("Modify") . '</a>';
|
||||||
|
|
||||||
@@ -349,7 +358,7 @@ if ($comments) {
|
|||||||
if ($user->rights->opensurvey->write) {
|
if ($user->rights->opensurvey->write) {
|
||||||
print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> ';
|
print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> ';
|
||||||
}
|
}
|
||||||
|
|
||||||
print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))." <br>";
|
print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))." <br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,21 +44,21 @@ class Opensurveysondage extends CommonObject
|
|||||||
|
|
||||||
var $id_sondage;
|
var $id_sondage;
|
||||||
var $commentaires;
|
var $commentaires;
|
||||||
|
|
||||||
var $mail_admin;
|
var $mail_admin;
|
||||||
var $nom_admin;
|
var $nom_admin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Id of user author of the poll
|
* Id of user author of the poll
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $fk_user_creat;
|
public $fk_user_creat;
|
||||||
|
|
||||||
var $titre;
|
var $titre;
|
||||||
var $date_fin='';
|
var $date_fin='';
|
||||||
var $format;
|
var $format;
|
||||||
var $mailsonde;
|
var $mailsonde;
|
||||||
|
|
||||||
public $sujet;
|
public $sujet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +66,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $allow_comments;
|
public $allow_comments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow users see others vote
|
* Allow users see others vote
|
||||||
* @var bool
|
* @var bool
|
||||||
@@ -127,9 +127,9 @@ class Opensurveysondage extends CommonObject
|
|||||||
$sql.= " ".$this->db->escape($this->allow_comments).",";
|
$sql.= " ".$this->db->escape($this->allow_comments).",";
|
||||||
$sql.= " ".$this->db->escape($this->allow_spy).",";
|
$sql.= " ".$this->db->escape($this->allow_spy).",";
|
||||||
$sql.= " '".$this->db->escape($this->sujet)."'";
|
$sql.= " '".$this->db->escape($this->sujet)."'";
|
||||||
|
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||||
@@ -141,7 +141,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
//// Call triggers
|
//// Call triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
@@ -150,7 +150,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
//// End call triggers
|
//// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
@@ -181,7 +181,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.id_sondage,";
|
$sql.= " t.id_sondage,";
|
||||||
$sql.= " t.commentaires,";
|
$sql.= " t.commentaires as description,";
|
||||||
$sql.= " t.mail_admin,";
|
$sql.= " t.mail_admin,";
|
||||||
$sql.= " t.nom_admin,";
|
$sql.= " t.nom_admin,";
|
||||||
$sql.= " t.fk_user_creat,";
|
$sql.= " t.fk_user_creat,";
|
||||||
@@ -207,8 +207,9 @@ class Opensurveysondage extends CommonObject
|
|||||||
$this->id_sondage = $obj->id_sondage;
|
$this->id_sondage = $obj->id_sondage;
|
||||||
//For compatibility
|
//For compatibility
|
||||||
$this->ref = $this->id_sondage;
|
$this->ref = $this->id_sondage;
|
||||||
|
|
||||||
$this->commentaires = $obj->commentaires;
|
$this->commentaires = $obj->description; // deprecated
|
||||||
|
$this->description = $obj->description;
|
||||||
$this->mail_admin = $obj->mail_admin;
|
$this->mail_admin = $obj->mail_admin;
|
||||||
$this->nom_admin = $obj->nom_admin;
|
$this->nom_admin = $obj->nom_admin;
|
||||||
$this->titre = $obj->titre;
|
$this->titre = $obj->titre;
|
||||||
@@ -275,7 +276,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").",";
|
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").",";
|
||||||
$sql.= " allow_comments=".$this->db->escape($this->allow_comments).",";
|
$sql.= " allow_comments=".$this->db->escape($this->allow_comments).",";
|
||||||
$sql.= " allow_spy=".$this->db->escape($this->allow_spy);
|
$sql.= " allow_spy=".$this->db->escape($this->allow_spy);
|
||||||
|
|
||||||
$sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'";
|
$sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'";
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@@ -437,75 +438,75 @@ class Opensurveysondage extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all comments for the current opensurvey poll
|
* Returns all comments for the current opensurvey poll
|
||||||
*
|
*
|
||||||
* @return Object[]
|
* @return Object[]
|
||||||
*/
|
*/
|
||||||
public function getComments() {
|
public function getComments() {
|
||||||
|
|
||||||
$sql = 'SELECT id_comment, usercomment, comment';
|
$sql = 'SELECT id_comment, usercomment, comment';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments';
|
||||||
$sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'";
|
$sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'";
|
||||||
$sql.= " ORDER BY id_comment";
|
$sql.= " ORDER BY id_comment";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
$num_rows=$this->db->num_rows($resql);
|
$num_rows=$this->db->num_rows($resql);
|
||||||
|
|
||||||
$comments = array();
|
$comments = array();
|
||||||
|
|
||||||
if ($num_rows > 0) {
|
if ($num_rows > 0) {
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
$comments[] = $obj;
|
$comments[] = $obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $comments;
|
return $comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a comment to the poll
|
* Adds a comment to the poll
|
||||||
*
|
*
|
||||||
* @param string $comment Comment content
|
* @param string $comment Comment content
|
||||||
* @param string $comment_user Comment author
|
* @param string $comment_user Comment author
|
||||||
* @return boolean False in case of the query fails, true if it was successful
|
* @return boolean False in case of the query fails, true if it was successful
|
||||||
*/
|
*/
|
||||||
public function addComment($comment, $comment_user) {
|
public function addComment($comment, $comment_user) {
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)";
|
||||||
$sql.= " VALUES ('".$this->db->escape($this->id_sondage)."','".$this->db->escape($comment)."','".$this->db->escape($comment_user)."')";
|
$sql.= " VALUES ('".$this->db->escape($this->id_sondage)."','".$this->db->escape($comment)."','".$this->db->escape($comment_user)."')";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
dol_syslog("sql=".$sql);
|
dol_syslog("sql=".$sql);
|
||||||
|
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a comment of the poll
|
* Deletes a comment of the poll
|
||||||
*
|
*
|
||||||
* @param int $id_comment Id of the comment
|
* @param int $id_comment Id of the comment
|
||||||
* @return boolean False in case of the query fails, true if it was successful
|
* @return boolean False in case of the query fails, true if it was successful
|
||||||
*/
|
*/
|
||||||
public function deleteComment($id_comment) {
|
public function deleteComment($id_comment) {
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = '.$this->id_sondage;
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = '.$this->id_sondage;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans all the class variables before doing an update or an insert
|
* Cleans all the class variables before doing an update or an insert
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function cleanParameters() {
|
private function cleanParameters() {
|
||||||
|
|
||||||
$this->id_sondage = trim($this->id_sondage);
|
$this->id_sondage = trim($this->id_sondage);
|
||||||
$this->commentaires = trim($this->commentaires);
|
$this->commentaires = trim($this->commentaires);
|
||||||
$this->mail_admin = trim($this->mail_admin);
|
$this->mail_admin = trim($this->mail_admin);
|
||||||
|
|||||||
@@ -192,11 +192,11 @@ if ($testmodifier)
|
|||||||
for ($i=0;$i<$nbcolonnes;$i++)
|
for ($i=0;$i<$nbcolonnes;$i++)
|
||||||
{
|
{
|
||||||
//var_dump($_POST["choix$i"]);
|
//var_dump($_POST["choix$i"]);
|
||||||
if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1')
|
if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1')
|
||||||
{
|
{
|
||||||
$nouveauchoix.="1";
|
$nouveauchoix.="1";
|
||||||
}
|
}
|
||||||
else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
|
else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2')
|
||||||
{
|
{
|
||||||
$nouveauchoix.="2";
|
$nouveauchoix.="2";
|
||||||
}
|
}
|
||||||
@@ -257,13 +257,12 @@ print '<div class="corps"> '."\n";
|
|||||||
|
|
||||||
//affichage du titre du sondage
|
//affichage du titre du sondage
|
||||||
$titre=str_replace("\\","",$object->titre);
|
$titre=str_replace("\\","",$object->titre);
|
||||||
print '<strong>'.dol_htmlentities($titre).'</strong><br>'."\n";
|
print '<strong>'.dol_htmlentities($titre).'</strong><br><br>'."\n";
|
||||||
|
|
||||||
//affichage des commentaires du sondage
|
//affichage des commentaires du sondage
|
||||||
if ($object->commentaires)
|
if ($object->commentaires)
|
||||||
{
|
{
|
||||||
$commentaires=dol_nl2br(dol_htmlentities($object->commentaires));
|
print dol_htmlentitiesbr($object->commentaires);
|
||||||
print $commentaires;
|
|
||||||
print '<br>'."\n";
|
print '<br>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,6 +395,11 @@ for ($i = 0; $i < $nbcolonnes; $i++)
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($object->fk_user_creat) {
|
||||||
|
$userstatic = new User($db);
|
||||||
|
$userstatic->fetch($object->fk_user_creat);
|
||||||
|
}
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
$result=$object->fetch(0,$numsondage);
|
$result=$object->fetch(0,$numsondage);
|
||||||
@@ -435,7 +440,7 @@ $linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).(! empty($socid)
|
|||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $form->showrefnav($object, 'sondage', $linkback, 1, 'id_sondage', 'id_sondage');
|
print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@@ -445,6 +450,33 @@ print '<tr><td>'.$langs->trans("Type").'</td><td colspan="2">';
|
|||||||
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
|
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
|
||||||
print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate").'</td></tr>';
|
print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate").'</td></tr>';
|
||||||
|
|
||||||
|
// Title
|
||||||
|
print '<tr><td>';
|
||||||
|
$adresseadmin=$object->mail_admin;
|
||||||
|
print $langs->trans("Title") .'</td><td colspan="2">';
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
|
print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(dol_htmlentities($object->titre)).'">';
|
||||||
|
}
|
||||||
|
else print dol_htmlentities($object->titre);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Expire date
|
||||||
|
print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">';
|
||||||
|
if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire');
|
||||||
|
else print dol_print_date($object->date_fin,'day');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Author
|
||||||
|
print '<tr><td>';
|
||||||
|
print $langs->trans("Author") .'</td><td colspan="2">';
|
||||||
|
if ($object->fk_user_creat) {
|
||||||
|
print $userstatic->getLoginUrl(1);
|
||||||
|
} else {
|
||||||
|
print dol_htmlentities($object->nom_admin);
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Link
|
// Link
|
||||||
print '<tr><td>'.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').'</td><td>';
|
print '<tr><td>'.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').'</td><td>';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
require_once('../../main.inc.php');
|
require_once('../../main.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
|
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@@ -62,39 +63,39 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre"))
|
|||||||
} else {
|
} else {
|
||||||
$_SESSION["mailsonde"] = false;
|
$_SESSION["mailsonde"] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('allow_comments') == 'on') {
|
if (GETPOST('allow_comments') == 'on') {
|
||||||
$_SESSION['allow_comments'] = true;
|
$_SESSION['allow_comments'] = true;
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['allow_comments'] = false;
|
$_SESSION['allow_comments'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('allow_spy') == 'on') {
|
if (GETPOST('allow_spy') == 'on') {
|
||||||
$_SESSION['allow_spy'] = true;
|
$_SESSION['allow_spy'] = true;
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['allow_spy'] = false;
|
$_SESSION['allow_spy'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$testdate = false;
|
$testdate = false;
|
||||||
|
$champdatefin = dol_mktime(0,0,0,GETPOST('champdatefinmonth'),GETPOST('champdatefinday'),GETPOST('champdatefinyear'));
|
||||||
if (GETPOST('champdatefin'))
|
|
||||||
|
if (GETPOST('champdatefin') && $champdatefin) // A date was provided
|
||||||
{
|
{
|
||||||
$registredate=explode("/",$_POST["champdatefin"]);
|
// Expire date is not before today
|
||||||
if (is_array($registredate) && count($registredate) === 3) {
|
if ($champdatefin - dol_now() > 0)
|
||||||
$time = mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]);
|
{
|
||||||
|
$testdate = true;
|
||||||
if ($time !== false && date('d/m/Y', $time) === $_POST["champdatefin"]) {
|
$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
|
||||||
//Expire date is not before today
|
}
|
||||||
if ($time - dol_now() > 0) {
|
else
|
||||||
$testdate = true;
|
{
|
||||||
$_SESSION['champdatefin'] = $time;
|
$testdate = true;
|
||||||
}
|
//setEventMessage($langs->trans('ExpiredDate'),'errors');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$testdate) {
|
if (! $testdate) {
|
||||||
setEventMessage($langs->trans('ErrorOpenSurveyDateFormat'), 'errors');
|
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("ExpireDate")), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($titre && $testdate)
|
if ($titre && $testdate)
|
||||||
@@ -141,19 +142,15 @@ if (! $_SESSION["titre"] && (GETPOST('creation_sondage_date') || GETPOST('creati
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
print '<tr><td>'. $langs->trans("Description") .'</td><td><textarea name="commentaires" rows="7" cols="40">'.$_SESSION["commentaires"].'</textarea></td>'."\n";
|
print '<tr><td>'. $langs->trans("Description") .'</td><td>';
|
||||||
|
$doleditor=new DolEditor('commentaires', $_SESSION["commentaires"],'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120);
|
||||||
|
$doleditor->Create(0,'');
|
||||||
|
print '</td>'."\n";
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">'. $langs->trans("ExpireDate") .'</td><td>';
|
print '<tr><td class="fieldrequired">'. $langs->trans("ExpireDate") .'</td><td>';
|
||||||
|
|
||||||
if (!GETPOST('champdatefin')) {
|
print $form->select_date($champdatefin?$champdatefin:-1,'champdatefin','','','',"add",1,0);
|
||||||
//172800 = 48 hours
|
|
||||||
$champdatefin = time() + 172800;
|
|
||||||
} else {
|
|
||||||
$champdatefin = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
print $form->select_date($champdatefin,'champdatefin','','','',"add",1,0);
|
|
||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
@@ -171,12 +168,12 @@ if ($_SESSION["mailsonde"]) $cochemail="checked";
|
|||||||
|
|
||||||
print '<input type="checkbox" name="mailsonde" '.$cochemail.'> '. $langs->trans("ToReceiveEMailForEachVote") .'<br>'."\n";
|
print '<input type="checkbox" name="mailsonde" '.$cochemail.'> '. $langs->trans("ToReceiveEMailForEachVote") .'<br>'."\n";
|
||||||
|
|
||||||
if ($_SESSION['allow_comments']) $allow_comments = "checked";
|
if ($_SESSION['allow_comments']) $allow_comments = 'checked="checked"';
|
||||||
|
if (isset($_POST['allow_comments'])) $allow_comments=GETPOST('allow_comments')?'checked="checked"':'';
|
||||||
print '<input type="checkbox" name="allow_comments" '.$allow_comments.'> '.$langs->trans('CanComment').'<br />'."\n";
|
print '<input type="checkbox" name="allow_comments" '.$allow_comments.'"> '.$langs->trans('CanComment').'<br />'."\n";
|
||||||
|
|
||||||
if ($_SESSION['allow_spy']) $allow_spy = "checked";
|
|
||||||
|
|
||||||
|
if ($_SESSION['allow_spy']) $allow_spy = 'checed="checked"';
|
||||||
|
if (isset($_POST['allow_spy'])) $allow_spy=GETPOST('allow_spy')?'checked="checked"':'';
|
||||||
print '<input type="checkbox" name="allow_spy" '.$allow_spy.'> '.$langs->trans('CanSeeOthersVote').'<br />'."\n";
|
print '<input type="checkbox" name="allow_spy" '.$allow_spy.'> '.$langs->trans('CanSeeOthersVote').'<br />'."\n";
|
||||||
|
|
||||||
if (GETPOST('choix_sondage'))
|
if (GETPOST('choix_sondage'))
|
||||||
|
|||||||
Reference in New Issue
Block a user