mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Removed the use of id_sondage_admin and survey_link_visible fields of llx_opensurvey_sondage
This commit is contained in:
parent
a5b9122e98
commit
1a038fac06
|
|
@ -18,4 +18,7 @@
|
|||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||
|
||||
ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
||||
ALTER TABLE `llx_opensurvey_sondage` ADD `allow_comments` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT 1 AFTER `canedit` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` ADD `allow_comments` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT 1 AFTER `canedit` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` DROP `survey_link_visible` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` DROP INDEX `idx_id_sondage_admin` ;
|
||||
ALTER TABLE `llx_opensurvey_sondage` DROP `id_sondage_admin` ;
|
||||
|
|
@ -15,5 +15,4 @@
|
|||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- ============================================================================
|
||||
|
||||
ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_id_sondage_admin (id_sondage_admin);
|
||||
ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin (date_fin);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
CREATE TABLE llx_opensurvey_sondage (
|
||||
id_sondage VARCHAR(16) PRIMARY KEY,
|
||||
id_sondage_admin VARCHAR(24),
|
||||
commentaires text,
|
||||
mail_admin VARCHAR(128),
|
||||
nom_admin VARCHAR(64),
|
||||
|
|
@ -25,7 +24,6 @@ CREATE TABLE llx_opensurvey_sondage (
|
|||
date_fin DATETIME,
|
||||
format VARCHAR(2),
|
||||
mailsonde varchar(2) DEFAULT '0',
|
||||
survey_link_visible integer DEFAULT 1,
|
||||
canedit integer DEFAULT 0,
|
||||
allow_comments TINYINT(1) unsigned NOT NULL DEFAULT 1,
|
||||
origin VARCHAR(64),
|
||||
|
|
|
|||
|
|
@ -35,16 +35,15 @@ if (!$user->admin) accessforbidden();
|
|||
|
||||
// Initialisation des variables
|
||||
$action=GETPOST('action');
|
||||
$numsondage = $numsondageadmin = '';
|
||||
$numsondage = '';
|
||||
|
||||
if (GETPOST('id')) {
|
||||
$numsondageadmin = GETPOST('id', 'alpha');
|
||||
$numsondage = substr($numsondageadmin, 0, 16);
|
||||
$numsondage = GETPOST('id', 'alpha');
|
||||
}
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
||||
$result=$object->fetch(0, $numsondageadmin);
|
||||
$result=$object->fetch(0, $numsondage);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
|
|
@ -63,7 +62,7 @@ $expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GE
|
|||
// Delete
|
||||
if ($action == 'delete_confirm')
|
||||
{
|
||||
$result=$object->delete($user,'',$numsondageadmin);
|
||||
$result=$object->delete($user,'',$numsondage);
|
||||
|
||||
header('Location: '.dol_buildpath('/opensurvey/list.php',1));
|
||||
exit();
|
||||
|
|
@ -87,7 +86,6 @@ if ($action == 'update')
|
|||
$object->commentaires = GETPOST('nouveauxcommentaires');
|
||||
$object->mail_admin = GETPOST('nouvelleadresse');
|
||||
$object->date_fin = $expiredate;
|
||||
$object->survey_link_visible = GETPOST('survey_link_visible')=='on'?1:0;
|
||||
$object->canedit = GETPOST('canedit')=='on'?1:0;
|
||||
$object->allow_comments = GETPOST('cancomment') == 'on' ? true : false;
|
||||
|
||||
|
|
@ -163,7 +161,7 @@ $toutsujet=str_replace("@","<br>",$toutsujet);
|
|||
$toutsujet=str_replace("°","'",$toutsujet);
|
||||
|
||||
|
||||
print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondageadmin.'" method="POST">'."\n";
|
||||
print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
$head = opensurvey_prepare_head($object);
|
||||
|
|
@ -178,7 +176,7 @@ $linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).'">'.$langs->tra
|
|||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'sondage', $linkback, 1, 'id_sondage_admin', 'id_sondage_admin');
|
||||
print $form->showrefnav($object, 'sondage', $linkback, 1, 'id_sondage', 'id_sondage');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
|
@ -274,15 +272,15 @@ dol_fiche_end();
|
|||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($action != 'edit') print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondageadmin . '">'.$langs->trans("Modify") . '</a>';
|
||||
if ($action != 'edit') print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id=' . $numsondage . '">'.$langs->trans("Modify") . '</a>';
|
||||
|
||||
if ($action != 'edit') print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.$numsondageadmin.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
if ($action != 'edit') print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.$numsondage.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?&id='.$numsondageadmin, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll",$id), 'delete_confirm', '', '', 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?&id='.$numsondage, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll",$id), 'delete_confirm', '', '', 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -299,7 +297,7 @@ $comments = $object->getComments();
|
|||
|
||||
if ($comments) {
|
||||
foreach ($comments as $comment) {
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?deletecomment='.$comment->id_comment.'&id='.$numsondageadmin.'"> '.img_picto('', 'delete.png').'</a> ';
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> ';
|
||||
print $comment->usercomment.': '.dol_nl2br($comment->comment)." <br>";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ if (!$user->admin) accessforbidden();
|
|||
|
||||
// Init vars
|
||||
$action=GETPOST('action');
|
||||
$numsondageadmin=GETPOST("id");
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
$numsondage= GETPOST("id");
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
$result=$object->fetch(0,$numsondage);
|
||||
|
|
@ -418,7 +417,7 @@ $linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).(! empty($socid)
|
|||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'sondage', $linkback, 1, 'id_sondage_admin', 'id_sondage_admin');
|
||||
print $form->showrefnav($object, 'sondage', $linkback, 1, 'id_sondage', 'id_sondage');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
|
@ -462,7 +461,7 @@ if (GETPOST('ajoutsujet'))
|
|||
{
|
||||
//on recupere les données et les sujets du sondage
|
||||
print '<form name="formulaire" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="id" value="'.$numsondageadmin.'">';
|
||||
print '<input type="hidden" name="id" value="'.$numsondage.'">';
|
||||
print '<input type="hidden" name="backtourl" value="'.GETPOST('backtourl').'">';
|
||||
|
||||
print '<div class="center">'."\n";
|
||||
|
|
@ -577,7 +576,7 @@ print '</div>'."\n";
|
|||
$nbcolonnes=substr_count($object->sujet,',')+1;
|
||||
|
||||
print '<form name="formulaire" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="id" value="'.$numsondageadmin.'">';
|
||||
print '<input type="hidden" name="id" value="'.$numsondage.'">';
|
||||
|
||||
print '<div class="cadre"> '."\n";
|
||||
print '<br>'."\n";
|
||||
|
|
@ -634,7 +633,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="annee"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="annee"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
print '<tr>'."\n";
|
||||
print '<td></td>'."\n";
|
||||
|
|
@ -660,7 +659,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="mois"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="mois"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
print '<tr>'."\n";
|
||||
print '<td></td>'."\n";
|
||||
|
|
@ -684,7 +683,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="jour"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="jour"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
//affichage des horaires
|
||||
|
|
@ -702,7 +701,7 @@ if ($object->format=="D"||$object->format=="D+")
|
|||
}
|
||||
}
|
||||
|
||||
print '<td class="heure"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage_admin.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '<td class="heure"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -719,7 +718,7 @@ else
|
|||
print '<td class="sujet">'.$tmp[0].'</td>'."\n";
|
||||
}
|
||||
|
||||
print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondageadmin.'&ajoutsujet=1&backtourl='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n";
|
||||
print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'&ajoutsujet=1&backtourl='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,11 +47,9 @@ class Opensurveysondage extends CommonObject
|
|||
var $mail_admin;
|
||||
var $nom_admin;
|
||||
var $titre;
|
||||
var $id_sondage_admin;
|
||||
var $date_fin='';
|
||||
var $format;
|
||||
var $mailsonde;
|
||||
var $survey_link_visible;
|
||||
var $canedit;
|
||||
|
||||
/**
|
||||
|
|
@ -91,10 +89,8 @@ class Opensurveysondage extends CommonObject
|
|||
if (isset($this->mail_admin)) $this->mail_admin=trim($this->mail_admin);
|
||||
if (isset($this->nom_admin)) $this->nom_admin=trim($this->nom_admin);
|
||||
if (isset($this->titre)) $this->titre=trim($this->titre);
|
||||
if (isset($this->id_sondage_admin)) $this->id_sondage_admin=trim($this->id_sondage_admin);
|
||||
if (isset($this->format)) $this->format=trim($this->format);
|
||||
if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde);
|
||||
if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible);
|
||||
if (isset($this->canedit)) $this->canedit=trim($this->canedit);
|
||||
|
||||
|
||||
|
|
@ -110,11 +106,9 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= "mail_admin,";
|
||||
$sql.= "nom_admin,";
|
||||
$sql.= "titre,";
|
||||
$sql.= "id_sondage_admin,";
|
||||
$sql.= "date_fin,";
|
||||
$sql.= "format,";
|
||||
$sql.= "mailsonde,";
|
||||
$sql.= "survey_link_visible,";
|
||||
$sql.= "canedit";
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
|
|
@ -123,11 +117,9 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= " ".(! isset($this->mail_admin)?'NULL':"'".$this->db->escape($this->mail_admin)."'").",";
|
||||
$sql.= " ".(! isset($this->nom_admin)?'NULL':"'".$this->db->escape($this->nom_admin)."'").",";
|
||||
$sql.= " ".(! isset($this->titre)?'NULL':"'".$this->db->escape($this->titre)."'").",";
|
||||
$sql.= " ".(! isset($this->id_sondage_admin)?'NULL':"'".$this->db->escape($this->id_sondage_admin)."'").",";
|
||||
$sql.= " ".(! isset($this->date_fin) || dol_strlen($this->date_fin)==0?'NULL':$this->db->idate($this->date_fin)).",";
|
||||
$sql.= " ".(! isset($this->format)?'NULL':"'".$this->db->escape($this->format)."'").",";
|
||||
$sql.= " ".(! isset($this->mailsonde)?'NULL':"'".$this->db->escape($this->mailsonde)."'").",";
|
||||
$sql.= " ".(! isset($this->survey_link_visible)?'NULL':"'".$this->db->escape($this->survey_link_visible)."'").",";
|
||||
$sql.= " ".(! isset($this->canedit)?'NULL':"'".$this->db->escape($this->canedit)."'")."";
|
||||
|
||||
$sql.= ")";
|
||||
|
|
@ -193,19 +185,16 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= " t.mail_admin,";
|
||||
$sql.= " t.nom_admin,";
|
||||
$sql.= " t.titre,";
|
||||
$sql.= " t.id_sondage_admin,";
|
||||
$sql.= " t.date_fin,";
|
||||
$sql.= " t.format,";
|
||||
$sql.= " t.mailsonde,";
|
||||
$sql.= " t.survey_link_visible,";
|
||||
$sql.= " t.canedit,";
|
||||
$sql.= " t.allow_comments,";
|
||||
$sql.= " t.sujet,";
|
||||
$sql.= " t.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t";
|
||||
if ($id > 0) $sql.= " WHERE t.rowid = ".$this->db->escape($id);
|
||||
else if (strlen($numsurvey) == 16) $sql.= " WHERE t.id_sondage = '".$this->db->escape($numsurvey)."'";
|
||||
else $sql.= " WHERE t.id_sondage_admin = '".$this->db->escape($numsurvey)."'";
|
||||
else $sql.= " WHERE t.id_sondage = '".$this->db->escape($numsurvey)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
|
@ -216,18 +205,15 @@ class Opensurveysondage extends CommonObject
|
|||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
//$this->id = $obj->rowid;
|
||||
$this->ref = $obj->id_sondage_admin;
|
||||
|
||||
$this->id_sondage = $obj->id_sondage;
|
||||
$this->commentaires = $obj->commentaires;
|
||||
$this->mail_admin = $obj->mail_admin;
|
||||
$this->nom_admin = $obj->nom_admin;
|
||||
$this->titre = $obj->titre;
|
||||
$this->id_sondage_admin = $obj->id_sondage_admin;
|
||||
$this->date_fin = $this->db->jdate($obj->date_fin);
|
||||
$this->format = $obj->format;
|
||||
$this->mailsonde = $obj->mailsonde;
|
||||
$this->survey_link_visible = $obj->survey_link_visible;
|
||||
$this->canedit = $obj->canedit;
|
||||
$this->allow_comments = $obj->allow_comments;
|
||||
$this->sujet = $obj->sujet;
|
||||
|
|
@ -275,10 +261,8 @@ class Opensurveysondage extends CommonObject
|
|||
if (isset($this->mail_admin)) $this->mail_admin=trim($this->mail_admin);
|
||||
if (isset($this->nom_admin)) $this->nom_admin=trim($this->nom_admin);
|
||||
if (isset($this->titre)) $this->titre=trim($this->titre);
|
||||
if (isset($this->id_sondage_admin)) $this->id_sondage_admin=trim($this->id_sondage_admin);
|
||||
if (isset($this->format)) $this->format=trim($this->format);
|
||||
if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde);
|
||||
if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible);
|
||||
$this->canedit = $this->canedit ? 1 : 0;
|
||||
$this->allow_comments = $this->allow_comments ? 1 : 0;
|
||||
|
||||
|
|
@ -293,16 +277,14 @@ class Opensurveysondage extends CommonObject
|
|||
$sql.= " mail_admin=".(isset($this->mail_admin)?"'".$this->db->escape($this->mail_admin)."'":"null").",";
|
||||
$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.= " id_sondage_admin=".(isset($this->id_sondage_admin)?"'".$this->db->escape($this->id_sondage_admin)."'":"null").",";
|
||||
$sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').",";
|
||||
$sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").",";
|
||||
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").",";
|
||||
$sql.= " survey_link_visible=".(isset($this->survey_link_visible)?$this->db->escape($this->survey_link_visible):"null").",";
|
||||
$sql.= " canedit=".$this->db->escape($this->canedit).",";
|
||||
$sql.= " allow_comments=".$this->db->escape($this->allow_comments);
|
||||
|
||||
//$sql.= " WHERE rowid=".$this->id;
|
||||
$sql.= " WHERE id_sondage_admin='".$this->db->escape($this->id_sondage_admin)."'";
|
||||
$sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
|
@ -350,16 +332,14 @@ class Opensurveysondage extends CommonObject
|
|||
*
|
||||
* @param User $user User that deletes
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @param string $numsondageadmin Num sondage admin to delete
|
||||
* @param string $numsondage Num sondage admin to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger, $numsondageadmin)
|
||||
function delete($user, $notrigger, $numsondage)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
|
|
@ -389,7 +369,7 @@ class Opensurveysondage extends CommonObject
|
|||
$resql=$this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."opensurvey_sondage";
|
||||
$sql.= " WHERE id_sondage_admin = '".$this->db->escape($numsondageadmin)."'";
|
||||
$sql.= " WHERE id_sondage = '".$this->db->escape($numsondage)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -515,11 +495,9 @@ class Opensurveysondage extends CommonObject
|
|||
$this->mail_admin='';
|
||||
$this->nom_admin='';
|
||||
$this->titre='';
|
||||
$this->id_sondage_admin='';
|
||||
$this->date_fin='';
|
||||
$this->format='';
|
||||
$this->mailsonde='';
|
||||
$this->survey_link_visible='';
|
||||
$this->canedit=0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
|||
require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php");
|
||||
|
||||
$action=GETPOST('action');
|
||||
$numsondage = $numsondageadmin = '';
|
||||
$numsondage = '';
|
||||
if (GETPOST('id'))
|
||||
{
|
||||
$numsondageadmin=GETPOST("id",'alpha');
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
$numsondage=GETPOST("id",'alpha');
|
||||
}
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@ function opensurvey_prepare_head(Opensurveysondage $object) {
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[0][0] = 'adminstuds.php?id='.$object->id_sondage_admin;
|
||||
$head[0][0] = 'adminstuds.php?id='.$object->id_sondage;
|
||||
$head[0][1] = $langs->trans("Card");
|
||||
$head[0][2] = 'general';
|
||||
$h++;
|
||||
|
||||
$head[1][0] = 'adminstuds_preview.php?id='.$object->id_sondage_admin;
|
||||
$head[1][0] = 'adminstuds_preview.php?id='.$object->id_sondage;
|
||||
$head[1][1] = $langs->trans("SurveyResults").'/'.$langs->trans("Preview");
|
||||
$head[1][2] = 'preview';
|
||||
$h++;
|
||||
|
|
@ -232,7 +232,6 @@ function ajouter_sondage($origin)
|
|||
global $conf, $db;
|
||||
|
||||
$sondage=dol_survey_random(16);
|
||||
$sondage_admin=$sondage.dol_survey_random(8);
|
||||
|
||||
if ($_SESSION["formatsondage"]=="A"||$_SESSION["formatsondage"]=="A+") {
|
||||
//extraction de la date de fin choisie
|
||||
|
|
@ -259,16 +258,16 @@ function ajouter_sondage($origin)
|
|||
|
||||
// Insert survey
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_sondage';
|
||||
$sql.= '(id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde, canedit, allow_comments, origin, sujet)';
|
||||
$sql.= '(id_sondage, commentaires, mail_admin, nom_admin, titre, date_fin, format, mailsonde, canedit, allow_comments, origin, sujet)';
|
||||
$sql.= " VALUES ('".$db->escape($sondage)."', '".$db->escape($_SESSION['commentaires'])."', '".$db->escape($_SESSION['adresse'])."', '".$db->escape($_SESSION['nom'])."',";
|
||||
$sql.= " '".$db->escape($_SESSION['titre'])."', '".$sondage_admin."', '".$db->idate($date_fin)."', '".$_SESSION['formatsondage']."', '".$db->escape($_SESSION['mailsonde'])."',";
|
||||
$sql.= " '".$db->escape($_SESSION['titre'])."', '".$db->idate($date_fin)."', '".$_SESSION['formatsondage']."', '".$db->escape($_SESSION['mailsonde'])."',";
|
||||
$sql.= " '".$canedit."', '".$allow_comments."', '".$db->escape($origin)."',";
|
||||
$sql.= " '".$db->escape($_SESSION['toutchoix'])."'";
|
||||
$sql.= ")";
|
||||
dol_syslog($sql);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($origin == 'dolibarr') $urlback=dol_buildpath('/opensurvey/adminstuds_preview.php',1).'?id='.$sondage_admin;
|
||||
if ($origin == 'dolibarr') $urlback=dol_buildpath('/opensurvey/adminstuds_preview.php',1).'?id='.$sondage;
|
||||
else
|
||||
{
|
||||
// Define $urlwithroot
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
|||
|
||||
$action=GETPOST('action');
|
||||
$id=GETPOST('id');
|
||||
$numsondage=substr($id, 0, 16);
|
||||
$numsondage= $id;
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="p.titre";
|
||||
|
|
@ -49,7 +49,7 @@ if ($action == 'delete_confirm')
|
|||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
||||
$result=$object->delete($user,'',$numsondageadmin);
|
||||
$result=$object->delete($user,'',$numsondage);
|
||||
|
||||
$db->commit();
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ if ($action == 'delete')
|
|||
print '<table class="liste">'."\n";
|
||||
print '<tr class="liste_titre"><td>'. $langs->trans("Ref").'</td><td>'. $langs->trans("Title") .'</td><td>'. $langs->trans("Type") .'</td><td>'. $langs->trans("Author") .'</td><td align="center">'. $langs->trans("ExpireDate") .'</td><td align="center">'. $langs->trans("NbOfVoters") .'</td><td colspan=2> </td>'."\n";
|
||||
|
||||
$sql = "SELECT id_sondage, id_sondage_admin, mail_admin, format, origin, date_fin, titre, nom_admin";
|
||||
$sql = "SELECT id_sondage, mail_admin, format, origin, date_fin, titre, nom_admin";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p";
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
|
|
@ -114,7 +114,7 @@ while ($i < min($num,$limit))
|
|||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?id='.$obj->id_sondage_admin.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?id='.$obj->id_sondage.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
|
||||
print '</td><td>'.$obj->titre.'</td><td>';
|
||||
$type=($obj->format=='A' || $obj->format=='A+')?'classic':'date';
|
||||
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
|
||||
|
|
@ -126,7 +126,7 @@ while ($i < min($num,$limit))
|
|||
print '</td>';
|
||||
|
||||
print'<td align="center">'.$nbuser.'</td>'."\n";
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->id_sondage_admin.'&action=delete">'.img_picto('', 'delete.png').'</a></td>'."\n";
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->id_sondage.'&action=delete">'.img_picto('', 'delete.png').'</a></td>'."\n";
|
||||
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -33,19 +33,10 @@ require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
|
|||
|
||||
// Init vars
|
||||
$action=GETPOST('action');
|
||||
$numsondage = $numsondageadmin = '';
|
||||
$numsondage = '';
|
||||
if (GETPOST('sondage'))
|
||||
{
|
||||
if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL
|
||||
{
|
||||
$numsondageadmin=GETPOST("sondage",'alpha');
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
$numsondageadmin='';
|
||||
$numsondage=GETPOST("sondage",'alpha');
|
||||
}
|
||||
$numsondage = GETPOST('sondage', 'alpha');
|
||||
}
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user