diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index cb174d2df9e..98830509bd7 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -157,12 +157,12 @@ class modOpenSurvey extends DolibarrModules 'titre'=>'NewSurvey', 'mainmenu'=>'opensurvey', 'leftmenu'=>'opensurvey_new', - 'url'=>'/opensurvey/public/index.php?origin=dolibarr', + 'url'=>'/opensurvey/public/index.php', 'langs'=>'opensurvey', 'position'=>210, 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. - 'perms'=>'', - 'target'=>'_blank', + 'perms'=>'$user->rights->opensurvey->write', + 'target'=>'', 'user'=>0); $r++; diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index ffd906c0299..4d85adb9782 100755 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -23,4 +23,5 @@ ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `survey_link_visible` ; ALTER TABLE `llx_opensurvey_sondage` DROP INDEX `idx_id_sondage_admin` ; ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `id_sondage_admin` ; ALTER TABLE `llx_opensurvey_sondage` DROP COLUMN `canedit` ; -ALTER TABLE `llx_opensurvey_sondage` ADD COLUMN `allow_spy` TINYINT( 1 ) UNSIGNED NOT NULL AFTER `allow_comments` ; \ No newline at end of file +ALTER TABLE `llx_opensurvey_sondage` ADD COLUMN `allow_spy` TINYINT( 1 ) UNSIGNED NOT NULL AFTER `allow_comments` ; +ALTER TABLE `llx_opensurvey_sondage` DROP `origin` ; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql index b697b0bc4ff..ce4add9e9f5 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql @@ -26,7 +26,6 @@ CREATE TABLE llx_opensurvey_sondage ( mailsonde varchar(2) DEFAULT '0', allow_comments TINYINT(1) unsigned NOT NULL DEFAULT 1, allow_spy TINYINT(1) unsigned NOT NULL DEFAULT 1, - origin VARCHAR(64), tms TIMESTAMP, sujet TEXT ) ENGINE=InnoDB; diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index e67591ffa61..5d532fead5b 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -51,7 +51,6 @@ class Opensurveysondage extends CommonObject var $format; var $mailsonde; - public $origin; public $sujet; /** @@ -108,7 +107,6 @@ class Opensurveysondage extends CommonObject $sql.= "mailsonde,"; $sql.= "allow_comments,"; $sql.= "allow_spy,"; - $sql.= "origin,"; $sql.= "sujet"; $sql.= ") VALUES ("; @@ -122,7 +120,6 @@ class Opensurveysondage extends CommonObject $sql.= " ".$this->db->escape($this->mailsonde).","; $sql.= " ".$this->db->escape($this->allow_comments).","; $sql.= " ".$this->db->escape($this->allow_spy).","; - $sql.= " '".$this->db->escape($this->origin)."',"; $sql.= " '".$this->db->escape($this->sujet)."'"; $sql.= ")"; @@ -497,7 +494,6 @@ class Opensurveysondage extends CommonObject $this->mailsonde = ($this->mailsonde ? 1 : 0); $this->allow_comments = ($this->allow_comments ? 1 : 0); $this->allow_spy = ($this->allow_spy ? 1 : 0); - $this->origin = trim($this->origin); $this->sujet = trim($this->sujet); } } diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 5106242963a..437f851d67b 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -218,7 +218,6 @@ function dol_survey_random($car) /** * Add a poll * - * @param string $origin Origin of poll creation * @return void */ function ajouter_sondage($origin) @@ -264,24 +263,10 @@ function ajouter_sondage($origin) $opensurveysondage->mailsonde = $_SESSION['mailsonde']; $opensurveysondage->allow_comments = $allow_comments; $opensurveysondage->allow_spy = $allow_spy; - $opensurveysondage->origin = $origin; $opensurveysondage->sujet = $_SESSION['toutchoix']; $opensurveysondage->create(null); - if ($origin == 'dolibarr') $urlback=dol_buildpath('/opensurvey/results.php',1).'?id='.$sondage; - else - { - // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - - $url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$sondage; - - $urlback=$url; - } - unset($_SESSION["titre"]); unset($_SESSION["nom"]); unset($_SESSION["adresse"]); @@ -292,6 +277,8 @@ function ajouter_sondage($origin) unset($_SESSION['toutchoix']); unset($_SESSION['totalchoixjour']); unset($_SESSION['champdatefin']); + + $urlback=dol_buildpath('/opensurvey/card.php',1).'?id='.$sondage; header("Location: ".$urlback); exit(); diff --git a/htdocs/opensurvey/public/choix_autre.php b/htdocs/opensurvey/public/choix_autre.php index 4785a2b6e28..d28f0621f8a 100644 --- a/htdocs/opensurvey/public/choix_autre.php +++ b/htdocs/opensurvey/public/choix_autre.php @@ -22,8 +22,6 @@ * \brief Page to create a new survey (choice selection) */ -define("NOLOGIN",1); // This means this output page does not require to be logged. -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. 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"); @@ -33,9 +31,6 @@ $erreur = false; $testdate = true; $date_selected = ''; -$origin=GETPOST('origin','alpha'); - - /* * Action @@ -103,7 +98,7 @@ if (isset($_POST["confirmecreation"]) || isset($_POST["confirmecreation_x"])) $_SESSION["formatsondage"]="A"; // Add into database - ajouter_sondage($origin); + ajouter_sondage(); } else { $_POST["fin_sondage_autre"] = 'ok'; } @@ -120,7 +115,7 @@ $form=new Form($db); $arrayofjs=array(); $arrayofcss=array('/opensurvey/css/style.css'); -llxHeaderSurvey($langs->trans("OpenSurvey"), "", 0, 0, $arrayofjs, $arrayofcss); +llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss); if (empty($_SESSION['titre']) || empty($_SESSION['nom']) || empty($_SESSION['adresse'])) { @@ -134,9 +129,8 @@ if (empty($_SESSION['titre']) || empty($_SESSION['nom']) || empty($_SESSION['adr //On prépare les données pour les inserer dans la base print '