mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Survey system has now a status like other objects. You can close or
reopen a survey.
This commit is contained in:
parent
25dfa0c5b9
commit
82745d32df
|
|
@ -35,6 +35,7 @@ ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NO
|
|||
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
|
||||
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
|
||||
|
||||
ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin;
|
||||
|
||||
ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ CREATE TABLE llx_opensurvey_sondage (
|
|||
fk_user_creat integer NOT NULL,
|
||||
titre TEXT NOT NULL,
|
||||
date_fin DATETIME NOT NULL,
|
||||
status integer DEFAULT 1,
|
||||
format VARCHAR(2) NOT NULL, -- 'A' = Text choice (choices are saved into sujet field), 'D' = Date choice (choices are saved into sujet field), 'F' = Form survey
|
||||
mailsonde tinyint NOT NULL DEFAULT 0,
|
||||
allow_comments tinyint NOT NULL DEFAULT 1,
|
||||
|
|
|
|||
|
|
@ -62,5 +62,5 @@ ErrorOpenSurveyOneChoice=Enter at least one choice
|
|||
ErrorOpenSurveyDateFormat=Date must have the format YYYY-MM-DD
|
||||
ErrorInsertingComment=There was an error while inserting your comment
|
||||
MoreChoices=Enter more choices for the voters
|
||||
SurveyExpiredInfo=The voting time of this poll has expired.
|
||||
SurveyExpiredInfo=The poll has been closed or voting delay has expired.
|
||||
EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n%s
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ if (!$user->rights->opensurvey->read) accessforbidden();
|
|||
|
||||
// Initialisation des variables
|
||||
$action=GETPOST('action');
|
||||
$cancel=GETPOST('cancel');
|
||||
|
||||
$numsondage = '';
|
||||
|
||||
if (GETPOST('id')) {
|
||||
|
|
@ -58,98 +60,119 @@ $expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GE
|
|||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('id' => $numsondage);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Delete
|
||||
if ($action == 'delete_confirm')
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
if ($cancel) $action='';
|
||||
|
||||
// Delete
|
||||
if ($action == 'delete_confirm')
|
||||
{
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
|
||||
$result=$object->delete($user,'',$numsondage);
|
||||
|
||||
header('Location: '.dol_buildpath('/opensurvey/list.php',1));
|
||||
exit();
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($action == 'close')
|
||||
{
|
||||
$object->status = Opensurveysondage::STATUS_CLOSED;
|
||||
$object->update();
|
||||
}
|
||||
|
||||
// Reopend
|
||||
if ($action == 'reopen')
|
||||
{
|
||||
$object->status = Opensurveysondage::STATUS_VALIDATED;
|
||||
$object->update();
|
||||
}
|
||||
|
||||
// Update
|
||||
if ($action == 'update')
|
||||
{
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
|
||||
$error=0;
|
||||
|
||||
if (! GETPOST('nouveautitre'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->titre = GETPOST('nouveautitre');
|
||||
$object->commentaires = GETPOST('nouveauxcommentaires');
|
||||
$object->mail_admin = GETPOST('nouvelleadresse');
|
||||
$object->date_fin = $expiredate;
|
||||
$object->allow_comments = GETPOST('cancomment') == 'on' ? true : false;
|
||||
$object->allow_spy = GETPOST('canseeothersvote') == 'on' ? true : false;
|
||||
$object->mailsonde = GETPOST('mailsonde') == 'on' ? true : false;
|
||||
|
||||
$res=$object->update($user);
|
||||
if ($res < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result=$object->delete($user,'',$numsondage);
|
||||
|
||||
header('Location: '.dol_buildpath('/opensurvey/list.php',1));
|
||||
exit();
|
||||
}
|
||||
|
||||
// Update
|
||||
if ($action == 'update')
|
||||
{
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
|
||||
$error=0;
|
||||
|
||||
if (! GETPOST('nouveautitre'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->titre = GETPOST('nouveautitre');
|
||||
$object->commentaires = GETPOST('nouveauxcommentaires');
|
||||
$object->mail_admin = GETPOST('nouvelleadresse');
|
||||
$object->date_fin = $expiredate;
|
||||
$object->allow_comments = GETPOST('cancomment') == 'on' ? true : false;
|
||||
$object->allow_spy = GETPOST('canseeothersvote') == 'on' ? true : false;
|
||||
$object->mailsonde = GETPOST('mailsonde') == 'on' ? true : false;
|
||||
|
||||
$res=$object->update($user);
|
||||
if ($res < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add comment
|
||||
if (GETPOST('ajoutcomment'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if (! GETPOST('comment'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors');
|
||||
}
|
||||
if (! GETPOST('commentuser'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$comment = GETPOST("comment");
|
||||
$comment_user = GETPOST('commentuser');
|
||||
|
||||
$resql = $object->addComment($comment, $comment_user);
|
||||
|
||||
if (! $resql)
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorInsertingComment'), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete comment
|
||||
$idcomment=GETPOST('deletecomment','int');
|
||||
if ($idcomment)
|
||||
{
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
|
||||
$resql = $object->deleteComment($idcomment);
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
// Add comment
|
||||
if (GETPOST('ajoutcomment'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if (! GETPOST('comment'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors');
|
||||
}
|
||||
if (! GETPOST('commentuser'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$comment = GETPOST("comment");
|
||||
$comment_user = GETPOST('commentuser');
|
||||
|
||||
$resql = $object->addComment($comment, $comment_user);
|
||||
|
||||
if (! $resql)
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorInsertingComment'), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete comment
|
||||
$idcomment=GETPOST('deletecomment','int');
|
||||
if ($idcomment)
|
||||
{
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
|
||||
$resql = $object->deleteComment($idcomment);
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -196,7 +219,7 @@ print '<table class="border" width="100%">';
|
|||
$linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage');
|
||||
print '</td>';
|
||||
|
|
@ -219,6 +242,12 @@ if ($action == 'edit')
|
|||
else print dol_htmlentities($object->titre);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Status") .'</td><td colspan="2">';
|
||||
print $object->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description") .'</td><td colspan="2">';
|
||||
if ($action == 'edit')
|
||||
|
|
@ -326,7 +355,11 @@ dol_fiche_end();
|
|||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<div class="center"><input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</form>'."\n";
|
||||
|
|
@ -340,9 +373,20 @@ print '<div class="tabsAction">';
|
|||
|
||||
if ($action != 'edit' && $user->rights->opensurvey->write) {
|
||||
|
||||
//Modify button
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondage . '">'.$langs->trans("Modify") . '</a>';
|
||||
//Modify button
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondage . '">'.$langs->trans("Modify") . '</a>';
|
||||
|
||||
if ($object->status == Opensurveysondage::STATUS_VALIDATED)
|
||||
{
|
||||
//Close button
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=close&id=' . $numsondage . '">'.$langs->trans("Close") . '</a>';
|
||||
}
|
||||
if ($object->status == Opensurveysondage::STATUS_CLOSED)
|
||||
{
|
||||
//Opened button
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=reopen&id=' . $numsondage . '">'.$langs->trans("ReOpen") . '</a>';
|
||||
}
|
||||
|
||||
//Delete button
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.$numsondage.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class Opensurveysondage extends CommonObject
|
|||
|
||||
var $titre;
|
||||
var $date_fin='';
|
||||
var $status=1;
|
||||
var $format;
|
||||
var $mailsonde;
|
||||
|
||||
|
|
@ -73,6 +74,22 @@ class Opensurveysondage extends CommonObject
|
|||
*/
|
||||
public $allow_spy;
|
||||
|
||||
|
||||
/**
|
||||
* Draft status (not used)
|
||||
*/
|
||||
const STATUS_DRAFT = 0;
|
||||
/**
|
||||
* Validated/Opened status
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
/**
|
||||
* Closed
|
||||
*/
|
||||
const STATUS_CLOSED = 2;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
|
@ -115,6 +132,7 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= "fk_user_creat,";
|
||||
$sql.= "titre,";
|
||||
$sql.= "date_fin,";
|
||||
$sql.= "status,";
|
||||
$sql.= "format,";
|
||||
$sql.= "mailsonde,";
|
||||
$sql.= "allow_comments,";
|
||||
|
|
@ -127,6 +145,7 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= " ".$user->id.",";
|
||||
$sql.= " '".$this->db->escape($this->titre)."',";
|
||||
$sql.= " '".$this->db->idate($this->date_fin)."',";
|
||||
$sql.= " ".$this->status.",";
|
||||
$sql.= " '".$this->db->escape($this->format)."',";
|
||||
$sql.= " ".$this->db->escape($this->mailsonde).",";
|
||||
$sql.= " ".$this->db->escape($this->allow_comments).",";
|
||||
|
|
@ -190,6 +209,7 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= " t.fk_user_creat,";
|
||||
$sql.= " t.titre,";
|
||||
$sql.= " t.date_fin,";
|
||||
$sql.= " t.status,";
|
||||
$sql.= " t.format,";
|
||||
$sql.= " t.mailsonde,";
|
||||
$sql.= " t.allow_comments,";
|
||||
|
|
@ -217,6 +237,7 @@ class Opensurveysondage extends CommonObject
|
|||
$this->nom_admin = $obj->nom_admin;
|
||||
$this->titre = $obj->titre;
|
||||
$this->date_fin = $this->db->jdate($obj->date_fin);
|
||||
$this->status = $obj->status;
|
||||
$this->format = $obj->format;
|
||||
$this->mailsonde = $obj->mailsonde;
|
||||
$this->allow_comments = $obj->allow_comments;
|
||||
|
|
@ -274,6 +295,7 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= " nom_admin=".(isset($this->nom_admin)?"'".$this->db->escape($this->nom_admin)."'":"null").",";
|
||||
$sql.= " titre=".(isset($this->titre)?"'".$this->db->escape($this->titre)."'":"null").",";
|
||||
$sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').",";
|
||||
$sql.= " status=".(isset($this->status)?"'".$this->db->escape($this->status)."'":"null").",";
|
||||
$sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").",";
|
||||
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").",";
|
||||
$sql.= " allow_comments=".$this->db->escape($this->allow_comments).",";
|
||||
|
|
@ -428,12 +450,13 @@ class Opensurveysondage extends CommonObject
|
|||
$this->id=0;
|
||||
|
||||
$this->id_sondage='';
|
||||
$this->commentaires='';
|
||||
$this->commentaires='Comment of the specimen survey';
|
||||
$this->mail_admin='';
|
||||
$this->nom_admin='';
|
||||
$this->titre='';
|
||||
$this->date_fin='';
|
||||
$this->format='';
|
||||
$this->titre='This is a specimen survey';
|
||||
$this->date_fin=dol_now()+3600*24*10;
|
||||
$this->status=1;
|
||||
$this->format='classic';
|
||||
$this->mailsonde='';
|
||||
}
|
||||
|
||||
|
|
@ -518,10 +541,74 @@ class Opensurveysondage extends CommonObject
|
|||
$this->mail_admin = trim($this->mail_admin);
|
||||
$this->nom_admin = trim($this->nom_admin);
|
||||
$this->titre = trim($this->titre);
|
||||
$this->status = trim($this->status);
|
||||
$this->format = trim($this->format);
|
||||
$this->mailsonde = ($this->mailsonde ? 1 : 0);
|
||||
$this->allow_comments = ($this->allow_comments ? 1 : 0);
|
||||
$this->allow_spy = ($this->allow_spy ? 1 : 0);
|
||||
$this->sujet = trim($this->sujet);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return status label of Order
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of status
|
||||
*
|
||||
* @param int $status Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function LibStatut($status,$mode)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
//print 'x'.$status.'-'.$billed;
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($status==self::STATUS_DRAFT) return $langs->trans('Draft');
|
||||
if ($status==self::STATUS_VALIDATED) return $langs->trans('Opened').$billedtext;
|
||||
if ($status==self::STATUS_CLOSED) return $langs->trans('Closed');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($status==self::STATUS_DRAFT) return $langs->trans('Draft');
|
||||
if ($status==self::STATUS_VALIDATED) return $langs->trans('Opened').$billedtext;
|
||||
if ($status==self::STATUS_CLOSED) return $langs->trans('Closed');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
|
||||
if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'),'statut1').' '.$langs->trans('Opened').$billedtext;
|
||||
if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'),'statut6').' '.$langs->trans('Closed');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'),'statut0');
|
||||
if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened').$billedtext,'statut1');
|
||||
if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'),'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
|
||||
if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened').$billedtext,'statut1').' '.$langs->trans('Opened').$billedtext;
|
||||
if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'),'statut6').' '.$langs->trans('Closed');
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('Draft').' </span>'.img_picto($langs->trans('Draft'),'statut0');
|
||||
if ($status==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('Opened').$billedtext.' </span>'.img_picto($langs->trans('Opened').$billedtext,'statut1');
|
||||
if ($status==self::STATUS_CLOSED) return '<span class="hideonsmartphone">'.$langs->trans('Closed').' </span>'.img_picto($langs->trans('Closed'),'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
require_once('../main.inc.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."/opensurvey/class/opensurveysondage.class.php");
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->opensurvey->read) accessforbidden();
|
||||
|
|
@ -68,6 +69,7 @@ if (GETPOST('button_removefilter'))
|
|||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$opensurvey_static = new Opensurveysondage($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
|
@ -96,6 +98,7 @@ print_liste_field_titre($langs->trans("Type"));
|
|||
print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser,$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NbOfVoters"));
|
||||
print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.status",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
|
@ -107,13 +110,14 @@ print '<td></td>';
|
|||
print '<td></td>';
|
||||
$arraystatus=array(''=>' ','expired'=>$langs->trans("Expired"),'opened'=>$langs->trans("Opened"));
|
||||
print '<td align="center">'. $form->selectarray('status', $arraystatus, $status).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.titre, p.nom_admin,";
|
||||
$sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre, p.nom_admin,";
|
||||
$sql.= " u.login, u.firstname, u.lastname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p";
|
||||
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat";
|
||||
|
|
@ -150,6 +154,9 @@ while ($i < min($num,$limit))
|
|||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
$opensurvey_static->id=$obj->id_sondage;
|
||||
$opensurvey_static->status=$obj->status;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
|
@ -176,11 +183,13 @@ while ($i < min($num,$limit))
|
|||
print '</td>';
|
||||
|
||||
print'<td align="center">'.$nbuser.'</td>'."\n";
|
||||
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_fin),'day');
|
||||
if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; }
|
||||
print '</td>';
|
||||
|
||||
print'<td align="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
|
||||
|
||||
print'<td align="center"></td>'."\n";
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ print '<table class="border" width="100%">';
|
|||
$linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage');
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
|
|||
$nblignes=$object->fetch_lines();
|
||||
|
||||
//If the survey has not yet finished, then it can be modified
|
||||
$canbemodified = (empty($object->date_fin) || $object->date_fin > dol_now());
|
||||
$canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user