code syntax public dir
This commit is contained in:
parent
50ae2d33b2
commit
df6650241d
@ -28,13 +28,27 @@
|
||||
* &id=..., &idfrom=..., &idto=...
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1'); // If there is no menu to show
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
|
||||
// It's a wrapper, so empty header
|
||||
@ -61,39 +75,69 @@ function llxFooterVierge()
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Security check
|
||||
if (empty($conf->agenda->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->agenda->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
// Not older than
|
||||
if (!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100; // default limit
|
||||
if (!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) {
|
||||
$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100; // default limit
|
||||
}
|
||||
|
||||
// Define format, type and filter
|
||||
$format = 'ical';
|
||||
$type = 'event';
|
||||
if (GETPOST("format", 'alpha')) $format = GETPOST("format", 'apha');
|
||||
if (GETPOST("type", 'apha')) $type = GETPOST("type", 'alpha');
|
||||
if (GETPOST("format", 'alpha')) {
|
||||
$format = GETPOST("format", 'apha');
|
||||
}
|
||||
if (GETPOST("type", 'apha')) {
|
||||
$type = GETPOST("type", 'alpha');
|
||||
}
|
||||
|
||||
$filters = array();
|
||||
if (GETPOST("year", 'int')) $filters['year'] = GETPOST("year", 'int');
|
||||
if (GETPOST("id", 'int')) $filters['id'] = GETPOST("id", 'int');
|
||||
if (GETPOST("idfrom", 'int')) $filters['idfrom'] = GETPOST("idfrom", 'int');
|
||||
if (GETPOST("idto", 'int')) $filters['idto'] = GETPOST("idto", 'int');
|
||||
if (GETPOST("project", 'apha')) $filters['project'] = GETPOST("project", 'apha');
|
||||
if (GETPOST("logina", 'apha')) $filters['logina'] = GETPOST("logina", 'apha');
|
||||
if (GETPOST("logint", 'apha')) $filters['logint'] = GETPOST("logint", 'apha');
|
||||
if (GETPOST("notactiontype", 'apha')) $filters['notactiontype'] = GETPOST("notactiontype", 'apha');
|
||||
if (GETPOST("actiontype", 'apha')) $filters['actiontype'] = GETPOST("actiontype", 'apha');
|
||||
if (GETPOST("notolderthan", 'int')) $filters['notolderthan'] = GETPOST("notolderthan", "int");
|
||||
else $filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
|
||||
if (GETPOST("year", 'int')) {
|
||||
$filters['year'] = GETPOST("year", 'int');
|
||||
}
|
||||
if (GETPOST("id", 'int')) {
|
||||
$filters['id'] = GETPOST("id", 'int');
|
||||
}
|
||||
if (GETPOST("idfrom", 'int')) {
|
||||
$filters['idfrom'] = GETPOST("idfrom", 'int');
|
||||
}
|
||||
if (GETPOST("idto", 'int')) {
|
||||
$filters['idto'] = GETPOST("idto", 'int');
|
||||
}
|
||||
if (GETPOST("project", 'apha')) {
|
||||
$filters['project'] = GETPOST("project", 'apha');
|
||||
}
|
||||
if (GETPOST("logina", 'apha')) {
|
||||
$filters['logina'] = GETPOST("logina", 'apha');
|
||||
}
|
||||
if (GETPOST("logint", 'apha')) {
|
||||
$filters['logint'] = GETPOST("logint", 'apha');
|
||||
}
|
||||
if (GETPOST("notactiontype", 'apha')) {
|
||||
$filters['notactiontype'] = GETPOST("notactiontype", 'apha');
|
||||
}
|
||||
if (GETPOST("actiontype", 'apha')) {
|
||||
$filters['actiontype'] = GETPOST("actiontype", 'apha');
|
||||
}
|
||||
if (GETPOST("notolderthan", 'int')) {
|
||||
$filters['notolderthan'] = GETPOST("notolderthan", "int");
|
||||
} else {
|
||||
$filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
|
||||
}
|
||||
|
||||
// Check config
|
||||
if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY))
|
||||
{
|
||||
if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
|
||||
$user->getrights();
|
||||
|
||||
llxHeaderVierge();
|
||||
@ -131,25 +175,45 @@ if ($reshook < 0) {
|
||||
$shortfilename = 'dolibarrcalendar';
|
||||
$filename = $shortfilename;
|
||||
// Complete long filename
|
||||
foreach ($filters as $key => $value)
|
||||
{
|
||||
foreach ($filters as $key => $value) {
|
||||
//if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename
|
||||
if ($key == 'year') $filename .= '-year'.$value;
|
||||
if ($key == 'id') $filename .= '-id'.$value;
|
||||
if ($key == 'idfrom') $filename .= '-idfrom'.$value;
|
||||
if ($key == 'idto') $filename .= '-idto'.$value;
|
||||
if ($key == 'project') $filename .= '-project'.$value;
|
||||
if ($key == 'logina') $filename .= '-logina'.$value; // Author
|
||||
if ($key == 'logint') $filename .= '-logint'.$value; // Assigned to
|
||||
if ($key == 'notactiontype') $filename .= '-notactiontype'.$value;
|
||||
if ($key == 'year') {
|
||||
$filename .= '-year'.$value;
|
||||
}
|
||||
if ($key == 'id') {
|
||||
$filename .= '-id'.$value;
|
||||
}
|
||||
if ($key == 'idfrom') {
|
||||
$filename .= '-idfrom'.$value;
|
||||
}
|
||||
if ($key == 'idto') {
|
||||
$filename .= '-idto'.$value;
|
||||
}
|
||||
if ($key == 'project') {
|
||||
$filename .= '-project'.$value;
|
||||
}
|
||||
if ($key == 'logina') {
|
||||
$filename .= '-logina'.$value; // Author
|
||||
}
|
||||
if ($key == 'logint') {
|
||||
$filename .= '-logint'.$value; // Assigned to
|
||||
}
|
||||
if ($key == 'notactiontype') {
|
||||
$filename .= '-notactiontype'.$value;
|
||||
}
|
||||
}
|
||||
// Add extension
|
||||
if ($format == 'vcal') { $shortfilename .= '.vcs'; $filename .= '.vcs'; }
|
||||
if ($format == 'ical') { $shortfilename .= '.ics'; $filename .= '.ics'; }
|
||||
if ($format == 'rss') { $shortfilename .= '.rss'; $filename .= '.rss'; }
|
||||
if ($format == 'vcal') {
|
||||
$shortfilename .= '.vcs'; $filename .= '.vcs';
|
||||
}
|
||||
if ($format == 'ical') {
|
||||
$shortfilename .= '.ics'; $filename .= '.ics';
|
||||
}
|
||||
if ($format == 'rss') {
|
||||
$shortfilename .= '.rss'; $filename .= '.rss';
|
||||
}
|
||||
|
||||
if ($shortfilename == 'dolibarrcalendar')
|
||||
{
|
||||
if ($shortfilename == 'dolibarrcalendar') {
|
||||
$langs->load("main");
|
||||
$langs->load("errors");
|
||||
llxHeaderVierge();
|
||||
@ -161,34 +225,47 @@ if ($shortfilename == 'dolibarrcalendar')
|
||||
$agenda = new ActionComm($db);
|
||||
|
||||
$cachedelay = 0;
|
||||
if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE;
|
||||
if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) {
|
||||
$cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE;
|
||||
}
|
||||
|
||||
$exportholidays = GETPOST('includeholidays', 'int');
|
||||
|
||||
// Build file
|
||||
if ($format == 'ical' || $format == 'vcal')
|
||||
{
|
||||
if ($format == 'ical' || $format == 'vcal') {
|
||||
$result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholidays);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($result >= 0) {
|
||||
$attachment = true;
|
||||
if (isset($_GET["attachment"])) $attachment = $_GET["attachment"];
|
||||
if (isset($_GET["attachment"])) {
|
||||
$attachment = $_GET["attachment"];
|
||||
}
|
||||
//$attachment = false;
|
||||
$contenttype = 'text/calendar';
|
||||
if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"];
|
||||
if (isset($_GET["contenttype"])) {
|
||||
$contenttype = $_GET["contenttype"];
|
||||
}
|
||||
//$contenttype='text/plain';
|
||||
$outputencoding = 'UTF-8';
|
||||
|
||||
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : ''));
|
||||
if ($attachment) header('Content-Disposition: attachment; filename="'.$shortfilename.'"');
|
||||
if ($contenttype) {
|
||||
header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : ''));
|
||||
}
|
||||
if ($attachment) {
|
||||
header('Content-Disposition: attachment; filename="'.$shortfilename.'"');
|
||||
}
|
||||
|
||||
if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
|
||||
else header('Cache-Control: private, must-revalidate');
|
||||
if ($cachedelay) {
|
||||
header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
|
||||
} else {
|
||||
header('Cache-Control: private, must-revalidate');
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
$outputfile = $conf->agenda->dir_temp.'/'.$filename;
|
||||
$result = readfile($outputfile);
|
||||
if (!$result) print 'File '.$outputfile.' was empty.';
|
||||
if (!$result) {
|
||||
print 'File '.$outputfile.' was empty.';
|
||||
}
|
||||
|
||||
//header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
|
||||
exit;
|
||||
@ -199,32 +276,43 @@ if ($format == 'ical' || $format == 'vcal')
|
||||
}
|
||||
}
|
||||
|
||||
if ($format == 'rss')
|
||||
{
|
||||
if ($format == 'rss') {
|
||||
$result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholidays);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($result >= 0) {
|
||||
$attachment = false;
|
||||
if (isset($_GET["attachment"])) $attachment = $_GET["attachment"];
|
||||
if (isset($_GET["attachment"])) {
|
||||
$attachment = $_GET["attachment"];
|
||||
}
|
||||
//$attachment = false;
|
||||
$contenttype = 'application/rss+xml';
|
||||
if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"];
|
||||
if (isset($_GET["contenttype"])) {
|
||||
$contenttype = $_GET["contenttype"];
|
||||
}
|
||||
//$contenttype='text/plain';
|
||||
$outputencoding = 'UTF-8';
|
||||
|
||||
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : ''));
|
||||
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
if ($contenttype) {
|
||||
header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : ''));
|
||||
}
|
||||
if ($attachment) {
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
}
|
||||
|
||||
// Ajout directives pour resoudre bug IE
|
||||
//header('Cache-Control: Public, must-revalidate');
|
||||
//header('Pragma: public');
|
||||
if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
|
||||
else header('Cache-Control: private, must-revalidate');
|
||||
if ($cachedelay) {
|
||||
header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
|
||||
} else {
|
||||
header('Cache-Control: private, must-revalidate');
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
$outputfile = $conf->agenda->dir_temp.'/'.$filename;
|
||||
$result = readfile($outputfile);
|
||||
if (!$result) print 'File '.$outputfile.' was empty.';
|
||||
if (!$result) {
|
||||
print 'File '.$outputfile.' was empty.';
|
||||
}
|
||||
|
||||
// header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
|
||||
exit;
|
||||
|
||||
@ -23,21 +23,34 @@
|
||||
* \ingroup cron
|
||||
* \brief Execute pendings jobs
|
||||
*/
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', '1');
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
// Error if CLI mode
|
||||
if (php_sapi_name() == "cli")
|
||||
{
|
||||
if (php_sapi_name() == "cli") {
|
||||
echo "Error: This page can't be used as a CLI script. For the CLI version of script, launch cron_run_job.php available into scripts/cron/ directory.\n";
|
||||
exit(-1);
|
||||
}
|
||||
@ -66,34 +79,29 @@ $now = dol_now();
|
||||
|
||||
// Check the key, avoid that a stranger starts cron
|
||||
$key = GETPOST('securitykey', 'alpha');
|
||||
if (empty($key))
|
||||
{
|
||||
if (empty($key)) {
|
||||
echo 'Securitykey is required. Check setup of cron jobs module.';
|
||||
exit;
|
||||
}
|
||||
if ($key != $conf->global->CRON_KEY)
|
||||
{
|
||||
if ($key != $conf->global->CRON_KEY) {
|
||||
echo 'Securitykey is wrong.';
|
||||
exit;
|
||||
}
|
||||
// Check the key, avoid that a stranger starts cron
|
||||
$userlogin = GETPOST('userlogin', 'alpha');
|
||||
if (empty($userlogin))
|
||||
{
|
||||
if (empty($userlogin)) {
|
||||
echo 'Userlogin is required.';
|
||||
exit;
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$user = new User($db);
|
||||
$result = $user->fetch('', $userlogin);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
echo "User Error:".$user->error;
|
||||
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
|
||||
exit;
|
||||
} else {
|
||||
if (empty($user->id))
|
||||
{
|
||||
if (empty($user->id)) {
|
||||
echo " User login:".$userlogin." do not exists";
|
||||
dol_syslog(" User login:".$userlogin." do not exists", LOG_ERR);
|
||||
exit;
|
||||
@ -107,8 +115,7 @@ $object = new Cronjob($db);
|
||||
|
||||
$filter = array();
|
||||
if (!empty($id)) {
|
||||
if (!is_numeric($id))
|
||||
{
|
||||
if (!is_numeric($id)) {
|
||||
echo "Error: Bad value for parameter job id";
|
||||
dol_syslog("cron_run_jobs.php Bad value for parameter job id", LOG_WARNING);
|
||||
exit;
|
||||
@ -117,17 +124,17 @@ if (!empty($id)) {
|
||||
}
|
||||
|
||||
$result = $object->fetch_all('ASC,ASC,ASC', 't.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
echo "Error: ".$object->error;
|
||||
dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
|
||||
$qualifiedjobs = array();
|
||||
foreach ($object->lines as $val)
|
||||
{
|
||||
if (!verifCond($val->test)) continue;
|
||||
foreach ($object->lines as $val) {
|
||||
if (!verifCond($val->test)) {
|
||||
continue;
|
||||
}
|
||||
$qualifiedjobs[] = $val;
|
||||
}
|
||||
|
||||
@ -138,19 +145,16 @@ $nbofjobs = count($qualifiedjobs);
|
||||
$nbofjobslaunchedok = 0;
|
||||
$nbofjobslaunchedko = 0;
|
||||
|
||||
if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0))
|
||||
{
|
||||
if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
|
||||
$savconf = dol_clone($conf);
|
||||
|
||||
// Loop over job
|
||||
foreach ($qualifiedjobs as $line)
|
||||
{
|
||||
foreach ($qualifiedjobs as $line) {
|
||||
dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG);
|
||||
echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label;
|
||||
|
||||
// Force reload of setup for the current entity
|
||||
if ($line->entity != $conf->entity)
|
||||
{
|
||||
if ($line->entity != $conf->entity) {
|
||||
dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG);
|
||||
echo " -> we change entity so we reload user and conf";
|
||||
|
||||
@ -158,17 +162,14 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0))
|
||||
$conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings
|
||||
|
||||
// Force recheck that user is ok for the entity to process and reload permission for entity
|
||||
if ($conf->entity != $user->entity && $user->entity != 0)
|
||||
{
|
||||
if ($conf->entity != $user->entity && $user->entity != 0) {
|
||||
$result = $user->fetch('', $userlogin, '', 0, $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
echo "\nUser Error: ".$user->error."\n";
|
||||
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
|
||||
exit(-1);
|
||||
} else {
|
||||
if ($result == 0)
|
||||
{
|
||||
if ($result == 0) {
|
||||
echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n";
|
||||
dol_syslog("User login:".$userlogin." does not exists", LOG_ERR);
|
||||
exit(-1);
|
||||
@ -179,16 +180,14 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0))
|
||||
}
|
||||
|
||||
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
|
||||
if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now))
|
||||
{
|
||||
if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) {
|
||||
echo " - qualified";
|
||||
|
||||
dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc'));
|
||||
|
||||
$cronjob = new Cronjob($db);
|
||||
$result = $cronjob->fetch($line->id);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
echo "Error cronjobid: ".$line->id." cronjob->fetch: ".$cronjob->error."\n";
|
||||
echo "Failed to fetch job ".$line->id."\n";
|
||||
dol_syslog("cron_run_jobs.php::fetch Error".$cronjob->error, LOG_ERR);
|
||||
@ -196,8 +195,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0))
|
||||
}
|
||||
// Execute job
|
||||
$result = $cronjob->run_jobs($userlogin);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
echo "Error cronjobid: ".$line->id." cronjob->run_job: ".$cronjob->error."\n";
|
||||
echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n";
|
||||
echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n";
|
||||
@ -211,8 +209,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0))
|
||||
|
||||
// We re-program the next execution and stores the last execution time for this job
|
||||
$result = $cronjob->reprogram_jobs($userlogin, $now);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
echo "Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n";
|
||||
echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n";
|
||||
dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR);
|
||||
|
||||
@ -24,10 +24,18 @@
|
||||
* \brief Entry page to access demo
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', 1);
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', 1);
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once '../../core/lib/functions2.lib.php';
|
||||
@ -42,7 +50,9 @@ $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
|
||||
|
||||
// Security check
|
||||
global $dolibarr_main_demo;
|
||||
if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page', 0, 0, 1);
|
||||
if (empty($dolibarr_main_demo)) {
|
||||
accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page', 0, 0, 1);
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$res = $hookmanager->initHooks(array('demo'));
|
||||
@ -66,8 +76,7 @@ $parameters = array();
|
||||
$object = new stdClass();
|
||||
$reshook = $hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
$demoprofiles = array(
|
||||
array('default'=>'1', 'key'=>'profdemoservonly', 'label'=>'DemoCompanyServiceOnly',
|
||||
'disablemodules'=>'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos',
|
||||
@ -131,27 +140,21 @@ $dirmod = array();
|
||||
$i = 0; // is a sequencer of modules found
|
||||
$j = 0; // j is module number. Automatically affected if module number not defined.
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
foreach ($modulesdir as $dir) {
|
||||
// Charge tableaux modules, nom, numero, orders depuis repertoire dir
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
//print "$i ".$file."\n<br>";
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
|
||||
{
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
|
||||
$modName = substr($file, 0, dol_strlen($file) - 10);
|
||||
|
||||
if ($modName)
|
||||
{
|
||||
if ($modName) {
|
||||
try {
|
||||
include_once $dir.$file;
|
||||
$objMod = new $modName($db);
|
||||
|
||||
if ($objMod->numero > 0)
|
||||
{
|
||||
if ($objMod->numero > 0) {
|
||||
$j = $objMod->numero;
|
||||
} else {
|
||||
$j = 1000 + $i;
|
||||
@ -161,11 +164,14 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
// We discard modules according to features level (PS: if module is activated we always show it)
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified = 0;
|
||||
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified = 0;
|
||||
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
if ($modulequalified) {
|
||||
$modules[$i] = $objMod;
|
||||
$filename[$i] = $modName;
|
||||
$orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
|
||||
@ -174,8 +180,7 @@ foreach ($modulesdir as $dir)
|
||||
$j++;
|
||||
$i++;
|
||||
}
|
||||
} catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
||||
}
|
||||
}
|
||||
@ -192,37 +197,34 @@ asort($orders);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules
|
||||
{
|
||||
if (GETPOST('action', 'aZ09') == 'gotodemo') { // Action run when we click on "Start" after selection modules
|
||||
//print 'ee'.GETPOST("demochoice");
|
||||
$disablestring = '';
|
||||
// If we disable modules using a profile choice
|
||||
if (GETPOST("demochoice"))
|
||||
{
|
||||
foreach ($demoprofiles as $profilearray)
|
||||
{
|
||||
if ($profilearray['key'] == GETPOST("demochoice"))
|
||||
{
|
||||
if (GETPOST("demochoice")) {
|
||||
foreach ($demoprofiles as $profilearray) {
|
||||
if ($profilearray['key'] == GETPOST("demochoice")) {
|
||||
$disablestring = $profilearray['disablemodules'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If we disable modules using personalized list
|
||||
foreach ($modules as $val)
|
||||
{
|
||||
foreach ($modules as $val) {
|
||||
$modulekeyname = strtolower($val->name);
|
||||
if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules))
|
||||
{
|
||||
if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) {
|
||||
$disablestring .= $modulekeyname.',';
|
||||
if ($modulekeyname == 'propale') $disablestring .= 'propal,';
|
||||
if ($modulekeyname == 'propale') {
|
||||
$disablestring .= 'propal,';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do redirect to login page
|
||||
if ($disablestring)
|
||||
{
|
||||
if (GETPOST('urlfrom')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha'));
|
||||
if ($disablestring) {
|
||||
if (GETPOST('urlfrom')) {
|
||||
$url .= (preg_match('/\?/', $url) ? '&' : '?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha'));
|
||||
}
|
||||
$url .= (preg_match('/\?/', $url) ? '&' : '?').'disablemodules='.$disablestring;
|
||||
//var_dump($url);exit;
|
||||
header("Location: ".$url);
|
||||
@ -288,12 +290,12 @@ print '<div class="clearboth"></div>';
|
||||
print '<div class="demobanbox">';
|
||||
|
||||
$i = 0;
|
||||
foreach ($demoprofiles as $profilearray)
|
||||
{
|
||||
if ($profilearray['default'] >= 0)
|
||||
{
|
||||
foreach ($demoprofiles as $profilearray) {
|
||||
if ($profilearray['default'] >= 0) {
|
||||
//print $profilearray['lang'];
|
||||
if (!empty($profilearray['lang'])) $langs->load($profilearray['lang']);
|
||||
if (!empty($profilearray['lang'])) {
|
||||
$langs->load($profilearray['lang']);
|
||||
}
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?action=gotodemo';
|
||||
$urlwithmod = $url.'&demochoice='.$profilearray['key'];
|
||||
@ -303,18 +305,15 @@ foreach ($demoprofiles as $profilearray)
|
||||
$urlfrom = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/i', '', $_SERVER["PHP_SELF"]);
|
||||
//print $urlfrom;
|
||||
|
||||
if (!empty($profilearray['url']))
|
||||
{
|
||||
if (!empty($profilearray['url'])) {
|
||||
$urlwithmod = $profilearray['url'];
|
||||
$urlwithmod = $urlwithmod.(preg_match('/\?/', $urlwithmod) ? '&' : '?').'urlfrom='.urlencode($urlfrom);
|
||||
if (!empty($profilearray['disablemodules']))
|
||||
{
|
||||
if (!empty($profilearray['disablemodules'])) {
|
||||
$urlwithmod = $urlwithmod.(preg_match('/\?/', $urlwithmod) ? '&' : '?').'disablemodules='.$profilearray['disablemodules'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($profilearray['url']))
|
||||
{
|
||||
if (empty($profilearray['url'])) {
|
||||
print '<div class="clearboth"></div>';
|
||||
}
|
||||
|
||||
@ -350,8 +349,7 @@ foreach ($demoprofiles as $profilearray)
|
||||
|
||||
|
||||
// Modules (a profile you must choose modules)
|
||||
if (empty($profilearray['url']))
|
||||
{
|
||||
if (empty($profilearray['url'])) {
|
||||
print '<div id="tr1'.$profilearray['key'].'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">';
|
||||
|
||||
print $langs->trans("ThisIsListOfModules").'<br><br>';
|
||||
@ -362,20 +360,26 @@ foreach ($demoprofiles as $profilearray)
|
||||
$j = 0;
|
||||
$nbcolsmod = empty($conf->dol_optimize_smallscreen) ? 4 : 3;
|
||||
//var_dump($modules);
|
||||
foreach ($orders as $index => $key) // Loop on qualified (enabled) modules
|
||||
{
|
||||
foreach ($orders as $index => $key) { // Loop on qualified (enabled) modules
|
||||
//print $index.' '.$key;
|
||||
$val = $modules[$index];
|
||||
$modulekeyname = strtolower($val->name);
|
||||
|
||||
$modulequalified = 1;
|
||||
if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) $modulequalified = 0;
|
||||
if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) $modulequalified = 0;
|
||||
if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) $modulequalified = 0;
|
||||
if (!$modulequalified) continue;
|
||||
if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if (!$modulequalified) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($modulekeyname, $alwayshiddencheckedmodules))
|
||||
{
|
||||
if (in_array($modulekeyname, $alwayshiddencheckedmodules)) {
|
||||
print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->';
|
||||
print '<input type="hidden" name="'.$modulekeyname.'" value="1">';
|
||||
} else {
|
||||
@ -384,8 +388,12 @@ foreach ($demoprofiles as $profilearray)
|
||||
print '<!-- id='.$val->numero.' -->';
|
||||
print '<div class="nowrap">';
|
||||
print '<input type="checkbox" class="checkbox" id="id'.$modulekeyname.'" name="'.$modulekeyname.'" value="1" title="'.dol_escape_htmltag($val->getName()).'"';
|
||||
if (in_array($modulekeyname, $alwaysuncheckedmodules)) print ' disabled';
|
||||
if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) print ' checked';
|
||||
if (in_array($modulekeyname, $alwaysuncheckedmodules)) {
|
||||
print ' disabled';
|
||||
}
|
||||
if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) {
|
||||
print ' checked';
|
||||
}
|
||||
print '> <label for="id'.$modulekeyname.'" class="inline-block demomaxoveflow" title="'.dol_escape_htmltag($val->getName()).'">'.$val->getName().'</label><br>';
|
||||
print '</div>';
|
||||
//if ($modulo == ($nbcolsmod - 1)) print '</tr>';
|
||||
@ -414,10 +422,8 @@ print '</div>';
|
||||
|
||||
// TODO Replace this with a hook
|
||||
// Google Adsense (need Google module)
|
||||
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT))
|
||||
{
|
||||
if (empty($conf->dol_use_jmobile))
|
||||
{
|
||||
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
|
||||
if (empty($conf->dol_use_jmobile)) {
|
||||
print '<div align="center">'."\n";
|
||||
print '<script><!--'."\n";
|
||||
print 'google_ad_client = "'.$conf->global->MAIN_GOOGLE_AD_CLIENT.'";'."\n";
|
||||
|
||||
@ -22,10 +22,18 @@
|
||||
* \brief Page to list donators
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
// C'est un wrapper, donc header vierge
|
||||
/**
|
||||
@ -51,7 +59,9 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
|
||||
// Security check
|
||||
if (empty($conf->don->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->don->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
$langs->load("donations");
|
||||
@ -68,11 +78,9 @@ $sql .= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
if ($num) {
|
||||
print "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
|
||||
print '<tr>';
|
||||
@ -81,13 +89,11 @@ if ($resql)
|
||||
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if ($objp->public)
|
||||
{
|
||||
if ($objp->public) {
|
||||
print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
|
||||
} else {
|
||||
print "<td>".$langs->trans("Anonymous")."</td>\n";
|
||||
|
||||
@ -25,13 +25,27 @@
|
||||
* \brief Script use to update mail status if destinaries read it (if images during mail read are display)
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRETRAN')) {
|
||||
define('NOREQUIRETRAN', '1');
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
/**
|
||||
* Header empty
|
||||
@ -63,14 +77,12 @@ $securitykey = GETPOST('securitykey');
|
||||
|
||||
dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG);
|
||||
|
||||
if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY)
|
||||
{
|
||||
if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) {
|
||||
print 'Bad security key value.';
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($tag))
|
||||
{
|
||||
if (!empty($tag)) {
|
||||
$statut = '2';
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'";
|
||||
dol_syslog("public/emailing/mailing-read.php : Mail read : ".$sql, LOG_DEBUG);
|
||||
|
||||
@ -27,11 +27,21 @@
|
||||
* https://myserver/public/emailing/mailing-unsubscribe.php?unsuscrib=1&securitykey=securitykey&tag=abcdefghijklmn
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
/**
|
||||
* Header empty
|
||||
@ -69,15 +79,13 @@ $securitykey = GETPOST('securitykey');
|
||||
|
||||
dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG);
|
||||
|
||||
if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY)
|
||||
{
|
||||
if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) {
|
||||
print 'Bad security key value.';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($tag) && ($unsuscrib == '1'))
|
||||
{
|
||||
if (!empty($tag) && ($unsuscrib == '1')) {
|
||||
dol_syslog("public/emailing/mailing-unsubscribe.php : Launch unsubscribe requests", LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT mc.email, m.entity";
|
||||
@ -85,12 +93,13 @@ if (!empty($tag) && ($unsuscrib == '1'))
|
||||
$sql .= " WHERE mc.fk_mailing = m.rowid AND mc.tag='".$db->escape($tag)."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if (empty($obj->email))
|
||||
{
|
||||
if (empty($obj->email)) {
|
||||
print 'Email not found. No need to unsubscribe.';
|
||||
exit;
|
||||
}
|
||||
@ -100,7 +109,9 @@ if (!empty($tag) && ($unsuscrib == '1'))
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
// Update status communication of thirdparty prospect (old usage)
|
||||
@ -109,7 +120,7 @@ if (!empty($tag) && ($unsuscrib == '1'))
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
|
||||
// Update status communication of contact prospect (old usage)
|
||||
// Update status communication of contact prospect (old usage)
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Dolibarr 401 error page</title>
|
||||
<title>Dolibarr 401 error page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
|
||||
<!-- <div data-role="header" data-theme="b">
|
||||
<h1>Introduction</h1>
|
||||
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
|
||||
</div>
|
||||
-->
|
||||
<div>
|
||||
<!-- <div data-role="header" data-theme="b">
|
||||
<h1>Introduction</h1>
|
||||
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
|
||||
</div>
|
||||
-->
|
||||
<div>
|
||||
|
||||
<h1>Error</h1>
|
||||
<h1>Error</h1>
|
||||
|
||||
<br>
|
||||
Sorry. You are not allowed to access this resource.
|
||||
<br>
|
||||
Sorry. You are not allowed to access this resource.
|
||||
|
||||
<br>
|
||||
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>
|
||||
<br>
|
||||
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Dolibarr 404 error page</title>
|
||||
<title>Dolibarr 404 error page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
|
||||
<!-- <div data-role="header" data-theme="b">
|
||||
<h1>Introduction</h1>
|
||||
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
|
||||
</div>
|
||||
-->
|
||||
<div>
|
||||
<!-- <div data-role="header" data-theme="b">
|
||||
<h1>Introduction</h1>
|
||||
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
|
||||
</div>
|
||||
-->
|
||||
<div>
|
||||
|
||||
<h2>Error</h2>
|
||||
<h2>Error</h2>
|
||||
|
||||
<br>
|
||||
You requested a website or a page that does not exists.
|
||||
<br>
|
||||
You requested a website or a page that does not exists.
|
||||
|
||||
<br>
|
||||
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>
|
||||
<br>
|
||||
<?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.htmlentities($_SERVER["HTTP_REFERER"]).'.' : ''; ?>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -37,17 +37,29 @@
|
||||
* MEMBER_NEWFORM_FORCECOUNTRYCODE Force country
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
@ -67,7 +79,9 @@ $action = GETPOST('action', 'aZ09');
|
||||
$langs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->adherent->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
print $langs->trans("Auto subscription form for public visitors has not been enabled");
|
||||
@ -226,8 +240,11 @@ if (empty($reshook) && $action == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('public')) $public = 1;
|
||||
else $public = 0;
|
||||
if (GETPOSTISSET('public')) {
|
||||
$public = 1;
|
||||
} else {
|
||||
$public = 0;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// email a peu pres correct et le login n'existe pas
|
||||
@ -259,7 +276,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extrafields->fetch_name_optionals_label($adh->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $adh);
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$result = $adh->create($user);
|
||||
if ($result > 0) {
|
||||
@ -285,7 +304,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER;
|
||||
|
||||
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
@ -303,9 +324,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
}
|
||||
/*if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}*/
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}*/
|
||||
}
|
||||
|
||||
// Send email to the foundation to say a new member subscribed with autosubscribe form
|
||||
@ -316,8 +337,12 @@ if (empty($reshook) && $action == 'add') {
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
} else $appli .= " ".DOL_VERSION;
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
||||
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
@ -355,8 +380,12 @@ if (empty($reshook) && $action == 'add') {
|
||||
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
|
||||
if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
@ -366,8 +395,12 @@ if (empty($reshook) && $action == 'add') {
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
@ -377,8 +410,12 @@ if (empty($reshook) && $action == 'add') {
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
@ -388,8 +425,12 @@ if (empty($reshook) && $action == 'add') {
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
@ -403,7 +444,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($entity)) $urlback .= '&entity='.$entity;
|
||||
if (!empty($entity)) {
|
||||
$urlback .= '&entity='.$entity;
|
||||
}
|
||||
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
|
||||
} else {
|
||||
$error++;
|
||||
@ -572,7 +615,9 @@ if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
|
||||
if ($country_code) {
|
||||
$new_country_id = getCountry($country_code, 3, $db, $langs);
|
||||
//print 'xxx'.$country_code.' - '.$new_country_id;
|
||||
if ($new_country_id) $country_id = $new_country_id;
|
||||
if ($new_country_id) {
|
||||
$country_id = $new_country_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
$country_code = getCountry($country_id, 2, $db, $langs);
|
||||
@ -581,8 +626,11 @@ print '</td></tr>';
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($country_code) print $formcompany->select_state(GETPOST("state_id"), $country_code);
|
||||
else print '';
|
||||
if ($country_code) {
|
||||
print $formcompany->select_state(GETPOST("state_id"), $country_code);
|
||||
} else {
|
||||
print '';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// EMail
|
||||
|
||||
@ -25,16 +25,26 @@
|
||||
* \brief File to show a public card of a member
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
@ -42,7 +52,9 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Security check
|
||||
if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->adherent->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
$langs->loadLangs(array("main", "members", "companies", "other"));
|
||||
@ -66,24 +78,27 @@ $extrafields = new ExtraFields($db);
|
||||
*/
|
||||
|
||||
$morehead = '';
|
||||
if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
|
||||
else $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
|
||||
if (!empty($conf->global->MEMBER_PUBLIC_CSS)) {
|
||||
$morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
|
||||
} else {
|
||||
$morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
|
||||
}
|
||||
|
||||
llxHeaderVierge($langs->trans("MemberCard"), $morehead);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
if ($id > 0) {
|
||||
$res = $object->fetch($id);
|
||||
if ($res < 0) { dol_print_error($db, $object->error); exit; }
|
||||
if ($res < 0) {
|
||||
dol_print_error($db, $object->error); exit;
|
||||
}
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
print load_fiche_titre($langs->trans("MemberCard"), '', '');
|
||||
|
||||
if (empty($object->public))
|
||||
{
|
||||
if (empty($object->public)) {
|
||||
print $langs->trans("ErrorThisMemberIsNotPublic");
|
||||
} else {
|
||||
print '<table class="public_border" cellspacing="0" width="100%" cellpadding="3">';
|
||||
@ -100,8 +115,7 @@ if ($id > 0)
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$object->email.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
|
||||
if (isset($object->photo) && $object->photo != '')
|
||||
{
|
||||
if (isset($object->photo) && $object->photo != '') {
|
||||
$form = new Form($db);
|
||||
print '<tr><td>URL Photo</td><td class="valeur">';
|
||||
print $form->showphoto('memberphoto', $object, 64);
|
||||
@ -139,7 +153,9 @@ function llxHeaderVierge($title, $head = "")
|
||||
print "<html>\n";
|
||||
print "<head>\n";
|
||||
print "<title>".$title."</title>\n";
|
||||
if ($head) print $head."\n";
|
||||
if ($head) {
|
||||
print $head."\n";
|
||||
}
|
||||
print "</head>\n";
|
||||
print '<body class="public_body">'."\n";
|
||||
}
|
||||
|
||||
@ -24,21 +24,33 @@
|
||||
* \brief File sample to list members
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Security check
|
||||
if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->adherent->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
$langs->loadLangs(array("main", "members", "companies", "other"));
|
||||
@ -59,7 +71,9 @@ function llxHeaderVierge($title, $head = "")
|
||||
print "<html>\n";
|
||||
print "<head>\n";
|
||||
print "<title>".$title."</title>\n";
|
||||
if ($head) print $head."\n";
|
||||
if ($head) {
|
||||
print $head."\n";
|
||||
}
|
||||
print "</head>\n";
|
||||
print '<body class="public_body">'."\n";
|
||||
}
|
||||
@ -82,7 +96,9 @@ $sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -90,8 +106,12 @@ $pagenext = $page + 1;
|
||||
$filter = GETPOST('filter');
|
||||
$statut = GETPOST('statut');
|
||||
|
||||
if (!$sortorder) { $sortorder = "ASC"; }
|
||||
if (!$sortfield) { $sortfield = "lastname"; }
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "lastname";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -101,8 +121,11 @@ if (!$sortfield) { $sortfield = "lastname"; }
|
||||
$form = new Form($db);
|
||||
|
||||
$morehead = '';
|
||||
if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
|
||||
else $morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
|
||||
if (!empty($conf->global->MEMBER_PUBLIC_CSS)) {
|
||||
$morehead = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">';
|
||||
} else {
|
||||
$morehead = '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php">';
|
||||
}
|
||||
|
||||
llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead);
|
||||
|
||||
@ -119,8 +142,7 @@ $sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
@ -138,8 +160,7 @@ if ($result)
|
||||
print_liste_field_titre("Photo", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'public_');
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
while ($i < $num && $i < $conf->liste_limit) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -148,8 +169,7 @@ if ($result)
|
||||
print '<td>'.$objp->email.'</td>'."\n";
|
||||
print '<td>'.$objp->zip.'</td>'."\n";
|
||||
print '<td>'.$objp->town.'</td>'."\n";
|
||||
if (isset($objp->photo) && $objp->photo != '')
|
||||
{
|
||||
if (isset($objp->photo) && $objp->photo != '') {
|
||||
print '<td>';
|
||||
print $form->showphoto('memberphoto', $objp, 64);
|
||||
print '</td>'."\n";
|
||||
|
||||
@ -24,11 +24,21 @@
|
||||
* /public/notice.php?transphrase=url_encoded_sentence_to_show
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOSESSION')) {
|
||||
define('NOSESSION', '1');
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
@ -37,13 +47,15 @@ require '../main.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
if (!GETPOST('transkey', 'alphanohtml') && !GETPOST('transphrase', 'alphanohtml'))
|
||||
{
|
||||
if (!GETPOST('transkey', 'alphanohtml') && !GETPOST('transphrase', 'alphanohtml')) {
|
||||
print 'Sorry, it seems your internet connexion is off.<br>';
|
||||
print 'You need to be connected to network to use this software.<br>';
|
||||
} else {
|
||||
$langs->loadLangs(array("error", "other"));
|
||||
|
||||
if (GETPOST('transphrase', 'alphanohtml')) print dol_escape_htmltag(GETPOST('transphrase', 'alphanohtml'));
|
||||
elseif (GETPOST('transkey', 'alphanohtml')) print dol_escape_htmltag($langs->trans(GETPOST('transkey', 'alphanohtml')));
|
||||
if (GETPOST('transphrase', 'alphanohtml')) {
|
||||
print dol_escape_htmltag(GETPOST('transphrase', 'alphanohtml'));
|
||||
} elseif (GETPOST('transkey', 'alphanohtml')) {
|
||||
print dol_escape_htmltag($langs->trans(GETPOST('transkey', 'alphanohtml')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,16 +23,26 @@
|
||||
* \brief File to offer a way to make an online signature for a particular Dolibarr entity
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
@ -60,12 +70,12 @@ $suffix = GETPOST("suffix", 'aZ09');
|
||||
$source = GETPOST("source", 'alpha');
|
||||
$ref = $REF = GETPOST("ref", 'alpha');
|
||||
|
||||
if (empty($source)) $source = 'proposal';
|
||||
if (empty($source)) {
|
||||
$source = 'proposal';
|
||||
}
|
||||
|
||||
if (!$action)
|
||||
{
|
||||
if ($source && !$ref)
|
||||
{
|
||||
if (!$action) {
|
||||
if ($source && !$ref) {
|
||||
print $langs->trans('ErrorBadParameters')." - ref missing";
|
||||
exit;
|
||||
}
|
||||
@ -81,23 +91,19 @@ $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than curren
|
||||
// Complete urls for post treatment
|
||||
$SECUREKEY = GETPOST("securekey"); // Secure key
|
||||
|
||||
if (!empty($source))
|
||||
{
|
||||
if (!empty($source)) {
|
||||
$urlok .= 'source='.urlencode($source).'&';
|
||||
$urlko .= 'source='.urlencode($source).'&';
|
||||
}
|
||||
if (!empty($REF))
|
||||
{
|
||||
if (!empty($REF)) {
|
||||
$urlok .= 'ref='.urlencode($REF).'&';
|
||||
$urlko .= 'ref='.urlencode($REF).'&';
|
||||
}
|
||||
if (!empty($SECUREKEY))
|
||||
{
|
||||
if (!empty($SECUREKEY)) {
|
||||
$urlok .= 'securekey='.urlencode($SECUREKEY).'&';
|
||||
$urlko .= 'securekey='.urlencode($SECUREKEY).'&';
|
||||
}
|
||||
if (!empty($entity))
|
||||
{
|
||||
if (!empty($entity)) {
|
||||
$urlok .= 'entity='.urlencode($entity).'&';
|
||||
$urlko .= 'entity='.urlencode($entity).'&';
|
||||
}
|
||||
@ -112,8 +118,7 @@ $creditor = $mysoc->name;
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'dosign')
|
||||
{
|
||||
if ($action == 'dosign') {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -123,7 +128,9 @@ if ($action == 'dosign')
|
||||
*/
|
||||
|
||||
$head = '';
|
||||
if (!empty($conf->global->MAIN_SIGN_CSS_URL)) $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (!empty($conf->global->MAIN_SIGN_CSS_URL)) {
|
||||
$head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
}
|
||||
|
||||
$conf->dol_hide_topmenu = 1;
|
||||
$conf->dol_hide_leftmenu = 1;
|
||||
@ -132,8 +139,7 @@ $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
|
||||
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1);
|
||||
|
||||
// Check link validity for param 'source'
|
||||
if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||
{
|
||||
if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', ''))) {
|
||||
$langs->load("errors");
|
||||
dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
|
||||
// End of page
|
||||
@ -161,24 +167,24 @@ print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||
$logosmall = $mysoc->logo_small;
|
||||
$logo = $mysoc->logo;
|
||||
$paramlogo = 'ONLINE_SIGN_LOGO_'.$suffix;
|
||||
if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo;
|
||||
elseif (!empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall = $conf->global->ONLINE_SIGN_LOGO;
|
||||
if (!empty($conf->global->$paramlogo)) {
|
||||
$logosmall = $conf->global->$paramlogo;
|
||||
} elseif (!empty($conf->global->ONLINE_SIGN_LOGO)) {
|
||||
$logosmall = $conf->global->ONLINE_SIGN_LOGO;
|
||||
}
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo = '';
|
||||
$urllogofull = '';
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
|
||||
{
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
|
||||
{
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
}
|
||||
// Output html code for logo
|
||||
if ($urllogo)
|
||||
{
|
||||
if ($urllogo) {
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="logopublicpayment">';
|
||||
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
|
||||
@ -192,16 +198,17 @@ if ($urllogo)
|
||||
|
||||
// Output introduction text
|
||||
$text = '';
|
||||
if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT))
|
||||
{
|
||||
if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) {
|
||||
$langs->load("members");
|
||||
$reg = array();
|
||||
if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."<br>\n";
|
||||
else $text .= $conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n";
|
||||
if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
|
||||
$text .= $langs->trans($reg[1])."<br>\n";
|
||||
} else {
|
||||
$text .= $conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n";
|
||||
}
|
||||
$text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||
}
|
||||
if (empty($text))
|
||||
{
|
||||
if (empty($text)) {
|
||||
$text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage", $mysoc->name).'</strong></td></tr>'."\n";
|
||||
$text .= '<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToSignDocFrom", $creditor).'<br><br></td></tr>'."\n";
|
||||
}
|
||||
@ -217,8 +224,7 @@ $error = 0;
|
||||
$var = false;
|
||||
|
||||
// Payment on customer order
|
||||
if ($source == 'proposal')
|
||||
{
|
||||
if ($source == 'proposal') {
|
||||
$found = true;
|
||||
$langs->load("proposal");
|
||||
|
||||
@ -226,8 +232,7 @@ if ($source == 'proposal')
|
||||
|
||||
$proposal = new Propal($db);
|
||||
$result = $proposal->fetch('', $ref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
$mesg = $proposal->error;
|
||||
$error++;
|
||||
} else {
|
||||
@ -258,9 +263,13 @@ if ($source == 'proposal')
|
||||
|
||||
|
||||
|
||||
if (!$found && !$mesg) $mesg = $langs->transnoentitiesnoconv("ErrorBadParameters");
|
||||
if (!$found && !$mesg) {
|
||||
$mesg = $langs->transnoentitiesnoconv("ErrorBadParameters");
|
||||
}
|
||||
|
||||
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).'</div></td></tr>'."\n";
|
||||
if ($mesg) {
|
||||
print '<tr><td align="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).'</div></td></tr>'."\n";
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
print "\n";
|
||||
|
||||
@ -22,10 +22,18 @@
|
||||
* \brief Page to list surveys
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
@ -37,8 +45,7 @@ require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php";
|
||||
// Init vars
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$numsondage = '';
|
||||
if (GETPOST('sondage'))
|
||||
{
|
||||
if (GETPOST('sondage')) {
|
||||
$numsondage = GETPOST('sondage', 'alpha');
|
||||
}
|
||||
|
||||
@ -51,7 +58,9 @@ $nblines = $object->fetch_lines();
|
||||
$canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED);
|
||||
|
||||
// Security check
|
||||
if (empty($conf->opensurvey->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->opensurvey->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -63,51 +72,49 @@ $nbcolonnes = substr_count($object->sujet, ',') + 1;
|
||||
$listofvoters = explode(',', $_SESSION["savevoter"]);
|
||||
|
||||
// Add comment
|
||||
if (GETPOST('ajoutcomment', 'alpha'))
|
||||
{
|
||||
if (!$canbemodified) accessforbidden('', 0, 0, 1);
|
||||
if (GETPOST('ajoutcomment', 'alpha')) {
|
||||
if (!$canbemodified) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
$comment = GETPOST("comment", 'restricthtml');
|
||||
$comment_user = GETPOST('commentuser', 'nohtml');
|
||||
|
||||
if (!$comment)
|
||||
{
|
||||
if (!$comment) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors');
|
||||
}
|
||||
if (!$comment_user)
|
||||
{
|
||||
if (!$comment_user) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors');
|
||||
}
|
||||
|
||||
if (!in_array($comment_user, $listofvoters))
|
||||
{
|
||||
if (!in_array($comment_user, $listofvoters)) {
|
||||
setEventMessages($langs->trans("UserMustBeSameThanUserUsedToVote"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$resql = $object->addComment($comment, $comment_user);
|
||||
|
||||
if (!$resql) dol_print_error($db);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add vote
|
||||
if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // boutonp for chrome, boutonp_x for firefox
|
||||
{
|
||||
if (!$canbemodified) accessforbidden('', 0, 0, 1);
|
||||
if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // boutonp for chrome, boutonp_x for firefox
|
||||
if (!$canbemodified) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
//Si le nom est bien entré
|
||||
if (GETPOST('nom', 'nohtml'))
|
||||
{
|
||||
if (GETPOST('nom', 'nohtml')) {
|
||||
$nouveauchoix = '';
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
if (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '1') {
|
||||
$nouveauchoix .= "1";
|
||||
} elseif (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '2') {
|
||||
@ -124,11 +131,12 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
|
||||
$sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users";
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$num_rows = $db->num_rows($resql);
|
||||
if ($num_rows > 0)
|
||||
{
|
||||
if ($num_rows > 0) {
|
||||
setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors');
|
||||
$error++;
|
||||
} else {
|
||||
@ -136,14 +144,12 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
|
||||
$sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')";
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
// Add voter to session
|
||||
$_SESSION["savevoter"] = $nom.','.(empty($_SESSION["savevoter"]) ? '' : $_SESSION["savevoter"]); // Save voter
|
||||
$listofvoters = explode(',', $_SESSION["savevoter"]);
|
||||
|
||||
if ($object->mailsonde)
|
||||
{
|
||||
if ($object->mailsonde) {
|
||||
if ($object->fk_user_creat) {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->fk_user_creat);
|
||||
@ -166,7 +172,9 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
|
||||
$result = $cmailfile->sendfile();
|
||||
}
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors');
|
||||
@ -178,28 +186,23 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
|
||||
$testmodifier = false;
|
||||
$testligneamodifier = false;
|
||||
$ligneamodifier = -1;
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
if (GETPOSTISSET('modifierligne'.$i))
|
||||
{
|
||||
for ($i = 0; $i < $nblines; $i++) {
|
||||
if (GETPOSTISSET('modifierligne'.$i)) {
|
||||
$ligneamodifier = $i;
|
||||
$testligneamodifier = true;
|
||||
}
|
||||
|
||||
//test to see if a line is to be modified
|
||||
if (GETPOSTISSET('validermodifier'.$i))
|
||||
{
|
||||
if (GETPOSTISSET('validermodifier'.$i)) {
|
||||
$modifier = $i;
|
||||
$testmodifier = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($testmodifier)
|
||||
{
|
||||
if ($testmodifier) {
|
||||
//var_dump($_POST);exit;
|
||||
$nouveauchoix = '';
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
//var_dump($_POST["choix$i"]);
|
||||
if (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '1') {
|
||||
$nouveauchoix .= "1";
|
||||
@ -210,7 +213,9 @@ if ($testmodifier)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$canbemodified) accessforbidden('', 0, 0, 1);
|
||||
if (!$canbemodified) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
$idtomodify = $_POST["idtomodify".$modifier];
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs";
|
||||
@ -218,14 +223,17 @@ if ($testmodifier)
|
||||
$sql .= " WHERE id_users = '".$db->escape($idtomodify)."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete comment
|
||||
$idcomment = GETPOST('deletecomment', 'int');
|
||||
if ($idcomment)
|
||||
{
|
||||
if (!$canbemodified) accessforbidden('', 0, 0, 1);
|
||||
if ($idcomment) {
|
||||
if (!$canbemodified) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
$resql = $object->deleteComment($idcomment);
|
||||
}
|
||||
@ -243,8 +251,7 @@ $arrayofcss = array('/opensurvey/css/style.css');
|
||||
|
||||
llxHeaderSurvey($object->title, "", 0, 0, $arrayofjs, $arrayofcss, $numsondage);
|
||||
|
||||
if (empty($object->ref)) // For survey, id is a hex string
|
||||
{
|
||||
if (empty($object->ref)) { // For survey, id is a hex string
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
|
||||
@ -257,8 +264,7 @@ if (empty($object->ref)) // For survey, id is a hex string
|
||||
// Define format of choices
|
||||
$toutsujet = explode(",", $object->sujet);
|
||||
$listofanswers = array();
|
||||
foreach ($toutsujet as $value)
|
||||
{
|
||||
foreach ($toutsujet as $value) {
|
||||
$tmp = explode('@', $value);
|
||||
$listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox'));
|
||||
}
|
||||
@ -276,8 +282,7 @@ $titre = str_replace("\\", "", $object->title);
|
||||
print '<strong>'.dol_htmlentities($titre).'</strong><br><br>'."\n";
|
||||
|
||||
// show description of survey
|
||||
if ($object->description)
|
||||
{
|
||||
if ($object->description) {
|
||||
print dol_htmlentitiesbr($object->description);
|
||||
print '<br>'."\n";
|
||||
}
|
||||
@ -300,8 +305,7 @@ print '<br><br>'."\n";
|
||||
print '<table class="resultats">'."\n";
|
||||
|
||||
// Show choice titles
|
||||
if ($object->format == "D")
|
||||
{
|
||||
if ($object->format == "D") {
|
||||
//display of survey topics
|
||||
print '<tr>'."\n";
|
||||
print '<td></td>'."\n";
|
||||
@ -309,8 +313,7 @@ if ($object->format == "D")
|
||||
//display of years
|
||||
$colspan = 1;
|
||||
$nbofsujet = count($toutsujet);
|
||||
for ($i = 0; $i < $nbofsujet; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbofsujet; $i++) {
|
||||
if (isset($toutsujet[$i + 1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i + 1]))) {
|
||||
$colspan++;
|
||||
} else {
|
||||
@ -386,8 +389,7 @@ if ($object->format == "D")
|
||||
print '<tr>'."\n";
|
||||
print '<td></td>'."\n";
|
||||
|
||||
for ($i = 0; isset($toutsujet[$i]); $i++)
|
||||
{
|
||||
for ($i = 0; isset($toutsujet[$i]); $i++) {
|
||||
$tmp = explode('@', $toutsujet[$i]);
|
||||
print '<td class="sujet">'.dol_escape_htmltag($tmp[0]).'</td>'."\n";
|
||||
}
|
||||
@ -404,14 +406,12 @@ $sql = "SELECT id_users, nom as name, id_sondage, reponses";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
|
||||
$sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$num = $db->num_rows($resql);
|
||||
while ($compteur < $num)
|
||||
{
|
||||
while ($compteur < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$ensemblereponses = $obj->reponses;
|
||||
@ -430,121 +430,167 @@ while ($compteur < $num)
|
||||
print '<td class="nom">'.dol_htmlentities($obj->name).'</td>'."\n";
|
||||
|
||||
// si la ligne n'est pas a changer, on affiche les données
|
||||
if (!$testligneamodifier)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
if (!$testligneamodifier) {
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
$car = substr($ensemblereponses, $i, 1);
|
||||
//print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz';
|
||||
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
|
||||
{
|
||||
if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n";
|
||||
else print '<td class="non">KO</td>'."\n";
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
|
||||
if (((string) $car) == "1") {
|
||||
print '<td class="ok">OK</td>'."\n";
|
||||
} else {
|
||||
print '<td class="non">KO</td>'."\n";
|
||||
}
|
||||
// Total
|
||||
if (!isset($sumfor[$i])) $sumfor[$i] = 0;
|
||||
if (((string) $car) == "1") $sumfor[$i]++;
|
||||
if (!isset($sumfor[$i])) {
|
||||
$sumfor[$i] = 0;
|
||||
}
|
||||
if (((string) $car) == "1") {
|
||||
$sumfor[$i]++;
|
||||
}
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
|
||||
{
|
||||
if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n";
|
||||
elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n";
|
||||
else print '<td class="vide"> </td>'."\n";
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
|
||||
if (((string) $car) == "1") {
|
||||
print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n";
|
||||
} elseif (((string) $car) == "0") {
|
||||
print '<td class="non">'.$langs->trans("No").'</td>'."\n";
|
||||
} else {
|
||||
print '<td class="vide"> </td>'."\n";
|
||||
}
|
||||
// Total
|
||||
if (!isset($sumfor[$i])) $sumfor[$i] = 0;
|
||||
if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
|
||||
if (((string) $car) == "1") $sumfor[$i]++;
|
||||
if (((string) $car) == "0") $sumagainst[$i]++;
|
||||
if (!isset($sumfor[$i])) {
|
||||
$sumfor[$i] = 0;
|
||||
}
|
||||
if (!isset($sumagainst[$i])) {
|
||||
$sumagainst[$i] = 0;
|
||||
}
|
||||
if (((string) $car) == "1") {
|
||||
$sumfor[$i]++;
|
||||
}
|
||||
if (((string) $car) == "0") {
|
||||
$sumagainst[$i]++;
|
||||
}
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
|
||||
{
|
||||
if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
|
||||
elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
|
||||
else print '<td class="vide"> </td>'."\n";
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
|
||||
if (((string) $car) == "1") {
|
||||
print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
|
||||
} elseif (((string) $car) == "0") {
|
||||
print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
|
||||
} else {
|
||||
print '<td class="vide"> </td>'."\n";
|
||||
}
|
||||
// Total
|
||||
if (!isset($sumfor[$i])) $sumfor[$i] = 0;
|
||||
if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
|
||||
if (((string) $car) == "1") $sumfor[$i]++;
|
||||
if (((string) $car) == "0") $sumagainst[$i]++;
|
||||
if (!isset($sumfor[$i])) {
|
||||
$sumfor[$i] = 0;
|
||||
}
|
||||
if (!isset($sumagainst[$i])) {
|
||||
$sumagainst[$i] = 0;
|
||||
}
|
||||
if (((string) $car) == "1") {
|
||||
$sumfor[$i]++;
|
||||
}
|
||||
if (((string) $car) == "0") {
|
||||
$sumagainst[$i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs
|
||||
if ($compteur == $ligneamodifier)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
if ($compteur == $ligneamodifier) {
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
$car = substr($ensemblereponses, $i, 1);
|
||||
print '<td class="vide">';
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
|
||||
{
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
|
||||
print '<input type="checkbox" name="choix'.$i.'" value="1" ';
|
||||
if ($car == '1') print 'checked';
|
||||
if ($car == '1') {
|
||||
print 'checked';
|
||||
}
|
||||
print '>';
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
|
||||
{
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
|
||||
$arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"));
|
||||
print $form->selectarray("choix".$i, $arraychoice, $car);
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
|
||||
{
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
|
||||
$arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For"));
|
||||
print $form->selectarray("choix".$i, $arraychoice, $car);
|
||||
}
|
||||
print '</td>'."\n";
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
$car = substr($ensemblereponses, $i, 1);
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
|
||||
{
|
||||
if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n";
|
||||
else print '<td class="non">KO</td>'."\n";
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
|
||||
if (((string) $car) == "1") {
|
||||
print '<td class="ok">OK</td>'."\n";
|
||||
} else {
|
||||
print '<td class="non">KO</td>'."\n";
|
||||
}
|
||||
// Total
|
||||
if (!isset($sumfor[$i])) $sumfor[$i] = 0;
|
||||
if (((string) $car) == "1") $sumfor[$i]++;
|
||||
if (!isset($sumfor[$i])) {
|
||||
$sumfor[$i] = 0;
|
||||
}
|
||||
if (((string) $car) == "1") {
|
||||
$sumfor[$i]++;
|
||||
}
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
|
||||
{
|
||||
if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
|
||||
elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
|
||||
else print '<td class="vide"> </td>'."\n";
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
|
||||
if (((string) $car) == "1") {
|
||||
print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
|
||||
} elseif (((string) $car) == "0") {
|
||||
print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
|
||||
} else {
|
||||
print '<td class="vide"> </td>'."\n";
|
||||
}
|
||||
// Total
|
||||
if (!isset($sumfor[$i])) $sumfor[$i] = 0;
|
||||
if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
|
||||
if (((string) $car) == "1") $sumfor[$i]++;
|
||||
if (((string) $car) == "0") $sumagainst[$i]++;
|
||||
if (!isset($sumfor[$i])) {
|
||||
$sumfor[$i] = 0;
|
||||
}
|
||||
if (!isset($sumagainst[$i])) {
|
||||
$sumagainst[$i] = 0;
|
||||
}
|
||||
if (((string) $car) == "1") {
|
||||
$sumfor[$i]++;
|
||||
}
|
||||
if (((string) $car) == "0") {
|
||||
$sumagainst[$i]++;
|
||||
}
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
|
||||
{
|
||||
if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
|
||||
elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
|
||||
else print '<td class="vide"> </td>'."\n";
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
|
||||
if (((string) $car) == "1") {
|
||||
print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
|
||||
} elseif (((string) $car) == "0") {
|
||||
print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
|
||||
} else {
|
||||
print '<td class="vide"> </td>'."\n";
|
||||
}
|
||||
// Total
|
||||
if (!isset($sumfor[$i])) $sumfor[$i] = 0;
|
||||
if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
|
||||
if (((string) $car) == "1") $sumfor[$i]++;
|
||||
if (((string) $car) == "0") $sumagainst[$i]++;
|
||||
if (!isset($sumfor[$i])) {
|
||||
$sumfor[$i] = 0;
|
||||
}
|
||||
if (!isset($sumagainst[$i])) {
|
||||
$sumagainst[$i] = 0;
|
||||
}
|
||||
if (((string) $car) == "1") {
|
||||
$sumfor[$i]++;
|
||||
}
|
||||
if (((string) $car) == "0") {
|
||||
$sumagainst[$i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Button edit at end of line
|
||||
if ($compteur != $ligneamodifier && $mod_ok)
|
||||
{
|
||||
if ($compteur != $ligneamodifier && $mod_ok) {
|
||||
print '<td class="casevide"><input type="submit" class="button smallpaddingimp" name="modifierligne'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Edit")).'"></td>'."\n";
|
||||
}
|
||||
|
||||
//demande de confirmation pour modification de ligne
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
if (GETPOSTISSET("modifierligne".$i))
|
||||
{
|
||||
if ($compteur == $i)
|
||||
{
|
||||
for ($i = 0; $i < $nblines; $i++) {
|
||||
if (GETPOSTISSET("modifierligne".$i)) {
|
||||
if ($compteur == $i) {
|
||||
print '<td class="casevide">';
|
||||
print '<input type="hidden" name="idtomodify'.$compteur.'" value="'.$obj->id_users.'">';
|
||||
print '<input type="submit" class="button button-save" name="validermodifier'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
@ -558,12 +604,10 @@ while ($compteur < $num)
|
||||
}
|
||||
|
||||
// Add line to add new record
|
||||
if ($ligneamodifier < 0 && (!isset($_SESSION['nom'])))
|
||||
{
|
||||
if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) {
|
||||
print '<tr>'."\n";
|
||||
print '<td class="nom">'."\n";
|
||||
if (isset($_SESSION['nom']))
|
||||
{
|
||||
if (isset($_SESSION['nom'])) {
|
||||
print '<input type=hidden name="nom" value="'.$_SESSION['nom'].'">'.$_SESSION['nom']."\n";
|
||||
} else {
|
||||
print '<input type="text" name="nom" placeholder="'.dol_escape_htmltag($langs->trans("Name")).'" maxlength="64" size="24">'."\n";
|
||||
@ -571,24 +615,20 @@ if ($ligneamodifier < 0 && (!isset($_SESSION['nom'])))
|
||||
print '</td>'."\n";
|
||||
|
||||
// affichage des cases de formulaire checkbox pour un nouveau choix
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
print '<td class="vide">';
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
|
||||
{
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
|
||||
print '<input type="checkbox" name="choix'.$i.'" value="1"';
|
||||
if (GETPOSTISSET('choix'.$i) && GETPOST('choix'.$i) == '1') {
|
||||
print ' checked';
|
||||
}
|
||||
print '>';
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
|
||||
{
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
|
||||
$arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"));
|
||||
print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i));
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
|
||||
{
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
|
||||
$arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For"));
|
||||
print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i));
|
||||
}
|
||||
@ -602,18 +642,15 @@ if ($ligneamodifier < 0 && (!isset($_SESSION['nom'])))
|
||||
|
||||
// Select value of best choice (for checkbox columns only)
|
||||
$nbofcheckbox = 0;
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
|
||||
$nbofcheckbox++;
|
||||
if (isset($sumfor[$i]))
|
||||
{
|
||||
if ($i == 0)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
|
||||
$nbofcheckbox++;
|
||||
}
|
||||
if (isset($sumfor[$i])) {
|
||||
if ($i == 0) {
|
||||
$meilleurecolonne = $sumfor[$i];
|
||||
}
|
||||
if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne)
|
||||
{
|
||||
if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) {
|
||||
$meilleurecolonne = $sumfor[$i];
|
||||
}
|
||||
}
|
||||
@ -623,30 +660,36 @@ if ($object->allow_spy) {
|
||||
// Show line total
|
||||
print '<tr>'."\n";
|
||||
print '<td class="center">'.$langs->trans("Total").'</td>'."\n";
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
$showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : '';
|
||||
$showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : '';
|
||||
if (empty($showsumfor)) $showsumfor = 0;
|
||||
if (empty($showsumagainst)) $showsumagainst = 0;
|
||||
if (empty($showsumfor)) {
|
||||
$showsumfor = 0;
|
||||
}
|
||||
if (empty($showsumagainst)) {
|
||||
$showsumagainst = 0;
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor;
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst;
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst;
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
|
||||
print $showsumfor;
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
|
||||
print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst;
|
||||
}
|
||||
if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
|
||||
print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst;
|
||||
}
|
||||
print '</td>'."\n";
|
||||
}
|
||||
print '</tr>';
|
||||
// Show picto winner
|
||||
if ($nbofcheckbox >= 2)
|
||||
{
|
||||
if ($nbofcheckbox >= 2) {
|
||||
print '<tr>'."\n";
|
||||
print '<td class="somme"></td>'."\n";
|
||||
for ($i = 0; $i < $nbcolonnes; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
//print 'xx'.(! empty($listofanswers[$i]['format'])).'-'.$sumfor[$i].'-'.$meilleurecolonne;
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne)
|
||||
{
|
||||
if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
|
||||
print '<td class="somme"><img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"></td>'."\n";
|
||||
} else {
|
||||
print '<td class="somme"></td>'."\n";
|
||||
@ -691,8 +734,7 @@ if ($object->allow_spy) {
|
||||
|
||||
|
||||
// Show best choice
|
||||
if ($nbofcheckbox >= 2)
|
||||
{
|
||||
if ($nbofcheckbox >= 2) {
|
||||
$vote_str = $langs->trans('votes');
|
||||
print '<p class="affichageresultats">'."\n";
|
||||
|
||||
@ -712,8 +754,7 @@ print '<br>';
|
||||
// Comment list
|
||||
$comments = $object->getComments();
|
||||
|
||||
if ($comments)
|
||||
{
|
||||
if ($comments) {
|
||||
print '<br><u><span class="bold opacitymedium">'.$langs->trans("CommentsOfVoters").':</span></u><br>'."\n";
|
||||
|
||||
foreach ($comments as $obj) {
|
||||
@ -721,7 +762,9 @@ if ($comments)
|
||||
//$mod_ok = (in_array($obj->name, $listofvoters));
|
||||
|
||||
print '<div class="comment"><span class="usercomment">';
|
||||
if (in_array($obj->usercomment, $listofvoters)) print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png', '', false, 0, 0, '', 'nomarginleft').'</a> ';
|
||||
if (in_array($obj->usercomment, $listofvoters)) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png', '', false, 0, 0, '', 'nomarginleft').'</a> ';
|
||||
}
|
||||
//else print img_picto('', 'ellipsis-h', '', false, 0, 0, '', 'nomarginleft').' ';
|
||||
print dol_htmlentities($obj->usercomment).':</span> <span class="comment">'.dol_nl2br(dol_htmlentities($obj->comment))."</span></div>";
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -25,45 +25,57 @@
|
||||
* This token can be used to get more informations.
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and this test must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
|
||||
if (!empty($conf->paypal->enabled))
|
||||
{
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
||||
}
|
||||
|
||||
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe"));
|
||||
|
||||
if (!empty($conf->paypal->enabled))
|
||||
{
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
$PAYPALTOKEN = GETPOST('TOKEN');
|
||||
if (empty($PAYPALTOKEN)) $PAYPALTOKEN = GETPOST('token');
|
||||
if (empty($PAYPALTOKEN)) {
|
||||
$PAYPALTOKEN = GETPOST('token');
|
||||
}
|
||||
$PAYPALPAYERID = GETPOST('PAYERID');
|
||||
if (empty($PAYPALPAYERID)) $PAYPALPAYERID = GETPOST('PayerID');
|
||||
if (empty($PAYPALPAYERID)) {
|
||||
$PAYPALPAYERID = GETPOST('PayerID');
|
||||
}
|
||||
}
|
||||
if (!empty($conf->paybox->enabled))
|
||||
{
|
||||
if (!empty($conf->paybox->enabled)) {
|
||||
}
|
||||
if (!empty($conf->stripe->enabled))
|
||||
{
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
}
|
||||
|
||||
$FULLTAG = GETPOST('FULLTAG');
|
||||
if (empty($FULLTAG)) $FULLTAG = GETPOST('fulltag');
|
||||
if (empty($FULLTAG)) {
|
||||
$FULLTAG = GETPOST('fulltag');
|
||||
}
|
||||
|
||||
$suffix = GETPOST("suffix", 'aZ09');
|
||||
|
||||
@ -71,12 +83,10 @@ $suffix = GETPOST("suffix", 'aZ09');
|
||||
// Detect $paymentmethod
|
||||
$paymentmethod = '';
|
||||
$reg = array();
|
||||
if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg))
|
||||
{
|
||||
if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg)) {
|
||||
$paymentmethod = $reg[1];
|
||||
}
|
||||
if (empty($paymentmethod))
|
||||
{
|
||||
if (empty($paymentmethod)) {
|
||||
dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used');
|
||||
exit;
|
||||
} else {
|
||||
@ -85,13 +95,21 @@ if (empty($paymentmethod))
|
||||
|
||||
|
||||
$validpaymentmethod = array();
|
||||
if (!empty($conf->paypal->enabled)) $validpaymentmethod['paypal'] = 'paypal';
|
||||
if (!empty($conf->paybox->enabled)) $validpaymentmethod['paybox'] = 'paybox';
|
||||
if (!empty($conf->stripe->enabled)) $validpaymentmethod['stripe'] = 'stripe';
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
$validpaymentmethod['paypal'] = 'paypal';
|
||||
}
|
||||
if (!empty($conf->paybox->enabled)) {
|
||||
$validpaymentmethod['paybox'] = 'paybox';
|
||||
}
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
$validpaymentmethod['stripe'] = 'stripe';
|
||||
}
|
||||
|
||||
|
||||
// Security check
|
||||
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($validpaymentmethod)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
$object = new stdClass(); // For triggers
|
||||
@ -111,12 +129,13 @@ $object = new stdClass(); // For triggers
|
||||
dol_syslog("Callback url when an online payment is refused or canceled. query_string=".(empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$tracepost = "";
|
||||
foreach ($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
||||
foreach ($_POST as $k => $v) {
|
||||
$tracepost .= "{$k} - {$v}\n";
|
||||
}
|
||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
|
||||
if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
{
|
||||
if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
|
||||
// Get on url call
|
||||
$fulltag = $FULLTAG;
|
||||
$onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN;
|
||||
@ -132,20 +151,20 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
if (is_object($object) && method_exists($object, 'call_trigger')) {
|
||||
// Call trigger
|
||||
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
// Send an email
|
||||
$sendemail = '';
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||
{
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) {
|
||||
$sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
}
|
||||
|
||||
// Send warning of error to administrator
|
||||
if ($sendemail)
|
||||
{
|
||||
if ($sendemail) {
|
||||
$companylangs = new Translate('', $conf);
|
||||
$companylangs->setDefaultLang($mysoc->default_lang);
|
||||
$companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox'));
|
||||
@ -155,14 +174,18 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
|
||||
// Define link to login card
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli))
|
||||
{
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
} else $appli .= " ".DOL_VERSION;
|
||||
} else $appli .= " ".DOL_VERSION;
|
||||
if (preg_match('/\d\.\d/', $appli)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
||||
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
|
||||
$urlback = $_SERVER["REQUEST_URI"];
|
||||
$topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed");
|
||||
@ -183,8 +206,7 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
|
||||
|
||||
$result = $mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
||||
} else {
|
||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
||||
@ -195,7 +217,9 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
}
|
||||
|
||||
$head = '';
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
|
||||
$head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
}
|
||||
|
||||
$conf->dol_hide_topmenu = 1;
|
||||
$conf->dol_hide_leftmenu = 1;
|
||||
@ -213,25 +237,25 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||
$logosmall = $mysoc->logo_small;
|
||||
$logo = $mysoc->logo;
|
||||
$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
|
||||
if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo;
|
||||
elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
|
||||
if (!empty($conf->global->$paramlogo)) {
|
||||
$logosmall = $conf->global->$paramlogo;
|
||||
} elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) {
|
||||
$logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
|
||||
}
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo = '';
|
||||
$urllogofull = '';
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
|
||||
{
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
|
||||
{
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
}
|
||||
|
||||
// Output html code for logo
|
||||
if ($urllogo)
|
||||
{
|
||||
if ($urllogo) {
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="logopublicpayment">';
|
||||
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
|
||||
@ -250,14 +274,15 @@ print '<br><br>';
|
||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||
|
||||
$key = 'ONLINE_PAYMENT_MESSAGE_KO';
|
||||
if (!empty($conf->global->$key)) print $conf->global->$key;
|
||||
if (!empty($conf->global->$key)) {
|
||||
print $conf->global->$key;
|
||||
}
|
||||
|
||||
$type = GETPOST('s', 'alpha');
|
||||
$ref = GETPOST('ref', 'alphanohtml');
|
||||
$tag = GETPOST('tag', 'alpha');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
if ($type || $tag)
|
||||
{
|
||||
if ($type || $tag) {
|
||||
$urlsubscription = getOnlinePaymentUrl(0, ($type ? $type : 'free'), $ref, $FinalPaymentAmt, $tag);
|
||||
|
||||
print $langs->trans("ClickHereToTryAgain", $urlsubscription);
|
||||
|
||||
@ -25,23 +25,32 @@
|
||||
* This token can be used to get more informations.
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
|
||||
if (!empty($conf->paypal->enabled))
|
||||
{
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
||||
}
|
||||
@ -49,29 +58,46 @@ if (!empty($conf->paypal->enabled))
|
||||
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal"));
|
||||
|
||||
// Clean parameters
|
||||
if (!empty($conf->paypal->enabled))
|
||||
{
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
$PAYPAL_API_USER = "";
|
||||
if (!empty($conf->global->PAYPAL_API_USER)) $PAYPAL_API_USER = $conf->global->PAYPAL_API_USER;
|
||||
if (!empty($conf->global->PAYPAL_API_USER)) {
|
||||
$PAYPAL_API_USER = $conf->global->PAYPAL_API_USER;
|
||||
}
|
||||
$PAYPAL_API_PASSWORD = "";
|
||||
if (!empty($conf->global->PAYPAL_API_PASSWORD)) $PAYPAL_API_PASSWORD = $conf->global->PAYPAL_API_PASSWORD;
|
||||
if (!empty($conf->global->PAYPAL_API_PASSWORD)) {
|
||||
$PAYPAL_API_PASSWORD = $conf->global->PAYPAL_API_PASSWORD;
|
||||
}
|
||||
$PAYPAL_API_SIGNATURE = "";
|
||||
if (!empty($conf->global->PAYPAL_API_SIGNATURE)) $PAYPAL_API_SIGNATURE = $conf->global->PAYPAL_API_SIGNATURE;
|
||||
if (!empty($conf->global->PAYPAL_API_SIGNATURE)) {
|
||||
$PAYPAL_API_SIGNATURE = $conf->global->PAYPAL_API_SIGNATURE;
|
||||
}
|
||||
$PAYPAL_API_SANDBOX = "";
|
||||
if (!empty($conf->global->PAYPAL_API_SANDBOX)) $PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX;
|
||||
if (!empty($conf->global->PAYPAL_API_SANDBOX)) {
|
||||
$PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX;
|
||||
}
|
||||
$PAYPAL_API_OK = "";
|
||||
if ($urlok) $PAYPAL_API_OK = $urlok;
|
||||
if ($urlok) {
|
||||
$PAYPAL_API_OK = $urlok;
|
||||
}
|
||||
$PAYPAL_API_KO = "";
|
||||
if ($urlko) $PAYPAL_API_KO = $urlko;
|
||||
if ($urlko) {
|
||||
$PAYPAL_API_KO = $urlko;
|
||||
}
|
||||
|
||||
$PAYPALTOKEN = GETPOST('TOKEN');
|
||||
if (empty($PAYPALTOKEN)) $PAYPALTOKEN = GETPOST('token');
|
||||
if (empty($PAYPALTOKEN)) {
|
||||
$PAYPALTOKEN = GETPOST('token');
|
||||
}
|
||||
$PAYPALPAYERID = GETPOST('PAYERID');
|
||||
if (empty($PAYPALPAYERID)) $PAYPALPAYERID = GETPOST('PayerID');
|
||||
if (empty($PAYPALPAYERID)) {
|
||||
$PAYPALPAYERID = GETPOST('PayerID');
|
||||
}
|
||||
}
|
||||
|
||||
$FULLTAG = GETPOST('FULLTAG');
|
||||
if (empty($FULLTAG)) $FULLTAG = GETPOST('fulltag');
|
||||
if (empty($FULLTAG)) {
|
||||
$FULLTAG = GETPOST('fulltag');
|
||||
}
|
||||
$source = GETPOST('s', 'alpha') ?GETPOST('s', 'alpha') : GETPOST('source', 'alpha');
|
||||
$ref = GETPOST('ref');
|
||||
|
||||
@ -81,12 +107,10 @@ $suffix = GETPOST("suffix", 'aZ09');
|
||||
// Detect $paymentmethod
|
||||
$paymentmethod = '';
|
||||
$reg = array();
|
||||
if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg))
|
||||
{
|
||||
if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg)) {
|
||||
$paymentmethod = $reg[1];
|
||||
}
|
||||
if (empty($paymentmethod))
|
||||
{
|
||||
if (empty($paymentmethod)) {
|
||||
dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used');
|
||||
exit;
|
||||
}
|
||||
@ -95,12 +119,20 @@ dol_syslog("***** paymentok.php is called paymentmethod=".$paymentmethod." FULLT
|
||||
|
||||
|
||||
$validpaymentmethod = array();
|
||||
if (!empty($conf->paypal->enabled)) $validpaymentmethod['paypal'] = 'paypal';
|
||||
if (!empty($conf->paybox->enabled)) $validpaymentmethod['paybox'] = 'paybox';
|
||||
if (!empty($conf->stripe->enabled)) $validpaymentmethod['stripe'] = 'stripe';
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
$validpaymentmethod['paypal'] = 'paypal';
|
||||
}
|
||||
if (!empty($conf->paybox->enabled)) {
|
||||
$validpaymentmethod['paybox'] = 'paybox';
|
||||
}
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
$validpaymentmethod['stripe'] = 'stripe';
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($validpaymentmethod)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
$ispaymentok = false;
|
||||
@ -130,11 +162,15 @@ $now = dol_now();
|
||||
dol_syslog("Callback url when a payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"]) ?dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"]) ?dol_escape_htmltag($_SERVER["SCRIPT_URI"]) : ''), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$tracepost = "";
|
||||
foreach ($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
||||
foreach ($_POST as $k => $v) {
|
||||
$tracepost .= "{$k} - {$v}\n";
|
||||
}
|
||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$head = '';
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
|
||||
$head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
}
|
||||
|
||||
$conf->dol_hide_topmenu = 1;
|
||||
$conf->dol_hide_leftmenu = 1;
|
||||
@ -153,25 +189,25 @@ print '<div id="dolpaymentdiv" class="center">'."\n";
|
||||
$logosmall = $mysoc->logo_small;
|
||||
$logo = $mysoc->logo;
|
||||
$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
|
||||
if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo;
|
||||
elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
|
||||
if (!empty($conf->global->$paramlogo)) {
|
||||
$logosmall = $conf->global->$paramlogo;
|
||||
} elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) {
|
||||
$logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
|
||||
}
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo = '';
|
||||
$urllogofull = '';
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
|
||||
{
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
|
||||
{
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
}
|
||||
|
||||
// Output html code for logo
|
||||
if ($urllogo)
|
||||
{
|
||||
if ($urllogo) {
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="logopublicpayment">';
|
||||
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
|
||||
@ -187,12 +223,9 @@ if ($urllogo)
|
||||
print '<br><br><br>';
|
||||
|
||||
|
||||
if (!empty($conf->paypal->enabled))
|
||||
{
|
||||
if ($paymentmethod == 'paypal') // We call this page only if payment is ok on payment system
|
||||
{
|
||||
if ($PAYPALTOKEN)
|
||||
{
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
if ($paymentmethod == 'paypal') { // We call this page only if payment is ok on payment system
|
||||
if ($PAYPALTOKEN) {
|
||||
// Get on url call
|
||||
$onlinetoken = $PAYPALTOKEN;
|
||||
$fulltag = $FULLTAG;
|
||||
@ -207,15 +240,13 @@ if (!empty($conf->paypal->enabled))
|
||||
dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
// Validate record
|
||||
if (!empty($paymentType))
|
||||
{
|
||||
if (!empty($paymentType)) {
|
||||
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_payment');
|
||||
$resArray = getDetails($onlinetoken);
|
||||
//var_dump($resarray);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING")
|
||||
{
|
||||
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
|
||||
// Nothing to do
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment');
|
||||
} else {
|
||||
@ -227,8 +258,7 @@ if (!empty($conf->paypal->enabled))
|
||||
//var_dump($resarray);
|
||||
|
||||
$ack = strtoupper($resArray2["ACK"]);
|
||||
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING")
|
||||
{
|
||||
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$object->source = $source;
|
||||
@ -263,22 +293,32 @@ if (!empty($conf->paypal->enabled))
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->paybox->enabled))
|
||||
{
|
||||
if ($paymentmethod == 'paybox') $ispaymentok = true; // We call this page only if payment is ok on payment system
|
||||
if (!empty($conf->paybox->enabled)) {
|
||||
if ($paymentmethod == 'paybox') {
|
||||
$ispaymentok = true; // We call this page only if payment is ok on payment system
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->stripe->enabled))
|
||||
{
|
||||
if ($paymentmethod == 'stripe') $ispaymentok = true; // We call this page only if payment is ok on payment system
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
if ($paymentmethod == 'stripe') {
|
||||
$ispaymentok = true; // We call this page only if payment is ok on payment system
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If data not provided from back url, search them into the session env
|
||||
if (empty($ipaddress)) $ipaddress = $_SESSION['ipaddress'];
|
||||
if (empty($TRANSACTIONID)) $TRANSACTIONID = $_SESSION['TRANSACTIONID'];
|
||||
if (empty($FinalPaymentAmt)) $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
if (empty($paymentType)) $paymentType = $_SESSION["paymentType"];
|
||||
if (empty($ipaddress)) {
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
}
|
||||
if (empty($TRANSACTIONID)) {
|
||||
$TRANSACTIONID = $_SESSION['TRANSACTIONID'];
|
||||
}
|
||||
if (empty($FinalPaymentAmt)) {
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
}
|
||||
if (empty($paymentType)) {
|
||||
$paymentType = $_SESSION["paymentType"];
|
||||
}
|
||||
|
||||
$fulltag = $FULLTAG;
|
||||
$tmptag = dolExplodeIntoArray($fulltag, '.', '=');
|
||||
@ -290,18 +330,22 @@ dol_syslog("ispaymentok=".$ispaymentok." tmptag=".var_export($tmptag, true), LOG
|
||||
// Make complementary actions
|
||||
$ispostactionok = 0;
|
||||
$postactionmessages = array();
|
||||
if ($ispaymentok)
|
||||
{
|
||||
if ($ispaymentok) {
|
||||
// Set permission for the anonymous user
|
||||
if (empty($user->rights->societe)) $user->rights->societe = new stdClass();
|
||||
if (empty($user->rights->facture)) $user->rights->facture = new stdClass();
|
||||
if (empty($user->rights->adherent)) { $user->rights->adherent = new stdClass(); $user->rights->adherent->cotisation = new stdClass(); }
|
||||
if (empty($user->rights->societe)) {
|
||||
$user->rights->societe = new stdClass();
|
||||
}
|
||||
if (empty($user->rights->facture)) {
|
||||
$user->rights->facture = new stdClass();
|
||||
}
|
||||
if (empty($user->rights->adherent)) {
|
||||
$user->rights->adherent = new stdClass(); $user->rights->adherent->cotisation = new stdClass();
|
||||
}
|
||||
$user->rights->societe->creer = 1;
|
||||
$user->rights->facture->creer = 1;
|
||||
$user->rights->adherent->cotisation->creer = 1;
|
||||
|
||||
if (array_key_exists('MEM', $tmptag) && $tmptag['MEM'] > 0)
|
||||
{
|
||||
if (array_key_exists('MEM', $tmptag) && $tmptag['MEM'] > 0) {
|
||||
// Validate member
|
||||
// Create subscription
|
||||
// Create complementary actions (this include creation of thirdparty)
|
||||
@ -322,16 +366,22 @@ if ($ispaymentok)
|
||||
|
||||
dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
if ($result1 > 0 && $result2 > 0)
|
||||
{
|
||||
if ($result1 > 0 && $result2 > 0) {
|
||||
$paymentTypeId = 0;
|
||||
if ($paymentmethod == 'paybox') $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'paypal') $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'stripe') $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
if (empty($paymentTypeId))
|
||||
{
|
||||
if ($paymentmethod == 'paybox') {
|
||||
$paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'paypal') {
|
||||
$paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'stripe') {
|
||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if (empty($paymentTypeId)) {
|
||||
$paymentType = $_SESSION["paymentType"];
|
||||
if (empty($paymentType)) $paymentType = 'CB';
|
||||
if (empty($paymentType)) {
|
||||
$paymentType = 'CB';
|
||||
}
|
||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||
}
|
||||
|
||||
@ -340,11 +390,9 @@ if ($ispaymentok)
|
||||
dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0)
|
||||
{
|
||||
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
|
||||
$result = $object->validate($user);
|
||||
if ($result < 0 || empty($object->datevalid))
|
||||
{
|
||||
if ($result < 0 || empty($object->datevalid)) {
|
||||
$error++;
|
||||
$errmsg = $object->error;
|
||||
$postactionmessages[] = $errmsg;
|
||||
@ -355,13 +403,14 @@ if ($ispaymentok)
|
||||
|
||||
// Subscription informations
|
||||
$datesubscription = $object->datevalid;
|
||||
if ($object->datefin > 0)
|
||||
{
|
||||
if ($object->datefin > 0) {
|
||||
$datesubscription = dol_time_plus_duree($object->datefin, 1, 'd');
|
||||
}
|
||||
|
||||
$datesubend = null;
|
||||
if ($datesubscription && $defaultdelay && $defaultdelayunit) $datesubend = dol_time_plus_duree(dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit), -1, 'd');
|
||||
if ($datesubscription && $defaultdelay && $defaultdelayunit) {
|
||||
$datesubend = dol_time_plus_duree(dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit), -1, 'd');
|
||||
}
|
||||
|
||||
$paymentdate = $now;
|
||||
$amount = $FinalPaymentAmt;
|
||||
@ -369,11 +418,16 @@ if ($ispaymentok)
|
||||
|
||||
// Payment informations
|
||||
$accountid = 0;
|
||||
if ($paymentmethod == 'paybox') $accountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'paypal') $accountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'stripe') $accountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
if ($accountid < 0)
|
||||
{
|
||||
if ($paymentmethod == 'paybox') {
|
||||
$accountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'paypal') {
|
||||
$accountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'stripe') {
|
||||
$accountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
}
|
||||
if ($accountid < 0) {
|
||||
$error++;
|
||||
$errmsg = 'Setup of bank account to use for payment is not correctly done for payment method '.$paymentmethod;
|
||||
$postactionmessages[] = $errmsg;
|
||||
@ -387,23 +441,27 @@ if ($ispaymentok)
|
||||
$emetteur_banque = '';
|
||||
// Define default choice for complementary actions
|
||||
$option = '';
|
||||
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $option = 'bankviainvoice';
|
||||
elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) $option = 'bankdirect';
|
||||
elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $option = 'invoiceonly';
|
||||
if (empty($option)) $option = 'none';
|
||||
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
|
||||
$option = 'bankviainvoice';
|
||||
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) {
|
||||
$option = 'bankdirect';
|
||||
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
|
||||
$option = 'invoiceonly';
|
||||
}
|
||||
if (empty($option)) {
|
||||
$option = 'none';
|
||||
}
|
||||
$sendalsoemail = 1;
|
||||
|
||||
// Record the subscription then complementary actions
|
||||
$db->begin();
|
||||
|
||||
// Create subscription
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
dol_syslog("Call ->subscription to create subscription", LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$crowid = $object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
|
||||
if ($crowid <= 0)
|
||||
{
|
||||
if ($crowid <= 0) {
|
||||
$error++;
|
||||
$errmsg = $object->error;
|
||||
$postactionmessages[] = $errmsg;
|
||||
@ -414,15 +472,13 @@ if ($ispaymentok)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
dol_syslog("Call ->subscriptionComplementaryActions option=".$option, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$autocreatethirdparty = 1; // will create thirdparty if member not yet linked to a thirdparty
|
||||
|
||||
$result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
dol_syslog("Error ".$object->error." ".join(',', $object->errors), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$error++;
|
||||
@ -430,18 +486,15 @@ if ($ispaymentok)
|
||||
$postactionmessages = array_merge($postactionmessages, $object->errors);
|
||||
$ispostactionok = -1;
|
||||
} else {
|
||||
if ($option == 'bankviainvoice')
|
||||
{
|
||||
if ($option == 'bankviainvoice') {
|
||||
$postactionmessages[] = 'Invoice, payment and bank record created';
|
||||
dol_syslog("Invoice, payment and bank record created", LOG_DEBUG, 0, '_payment');
|
||||
}
|
||||
if ($option == 'bankdirect')
|
||||
{
|
||||
if ($option == 'bankdirect') {
|
||||
$postactionmessages[] = 'Bank record created';
|
||||
dol_syslog("Bank record created", LOG_DEBUG, 0, '_payment');
|
||||
}
|
||||
if ($option == 'invoiceonly')
|
||||
{
|
||||
if ($option == 'invoiceonly') {
|
||||
$postactionmessages[] = 'Invoice recorded';
|
||||
dol_syslog("Invoice recorded", LOG_DEBUG, 0, '_payment');
|
||||
}
|
||||
@ -451,18 +504,15 @@ if ($ispaymentok)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($paymentmethod == 'stripe' && $autocreatethirdparty && $option == 'bankviainvoice')
|
||||
{
|
||||
if (!$error) {
|
||||
if ($paymentmethod == 'stripe' && $autocreatethirdparty && $option == 'bankviainvoice') {
|
||||
$thirdparty_id = $object->fk_soc;
|
||||
|
||||
dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha'))
|
||||
{
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 1;
|
||||
}
|
||||
@ -477,8 +527,7 @@ if ($ispaymentok)
|
||||
|
||||
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
|
||||
|
||||
if (!$customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link
|
||||
{
|
||||
if (!$customer && $TRANSACTIONID) { // Not linked to a stripe customer, we make the link
|
||||
dol_syslog("No stripe profile found, so we add it for TRANSACTIONID = ".$TRANSACTIONID, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
try {
|
||||
@ -541,13 +590,11 @@ if ($ispaymentok)
|
||||
}
|
||||
|
||||
// Send email to member
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
dol_syslog("Send email to customer to ".$object->email." if we have to (sendalsoemail = ".$sendalsoemail.")", LOG_DEBUG, 0, '_payment');
|
||||
|
||||
// Send confirmation Email
|
||||
if ($object->email && $sendalsoemail)
|
||||
{
|
||||
if ($object->email && $sendalsoemail) {
|
||||
$subject = '';
|
||||
$msg = '';
|
||||
|
||||
@ -563,10 +610,11 @@ if ($ispaymentok)
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
|
||||
|
||||
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
|
||||
{
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
@ -581,8 +629,7 @@ if ($ispaymentok)
|
||||
$listofpaths = array();
|
||||
$listofnames = array();
|
||||
$listofmimes = array();
|
||||
if (is_object($object->invoice))
|
||||
{
|
||||
if (is_object($object->invoice)) {
|
||||
$invoicediroutput = $conf->facture->dir_output;
|
||||
$fileparams = dol_most_recent_file($invoicediroutput.'/'.$object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
@ -596,14 +643,16 @@ if ($ispaymentok)
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$errmsg = $object->error;
|
||||
$postactionmessages[] = $errmsg;
|
||||
$ispostactionok = -1;
|
||||
} else {
|
||||
if ($file) $postactionmessages[] = 'Email sent to member (with invoice document attached)';
|
||||
else $postactionmessages[] = 'Email sent to member (without any attached document)';
|
||||
if ($file) {
|
||||
$postactionmessages[] = 'Email sent to member (with invoice document attached)';
|
||||
} else {
|
||||
$postactionmessages[] = 'Email sent to member (without any attached document)';
|
||||
}
|
||||
|
||||
// TODO Add actioncomm event
|
||||
}
|
||||
@ -617,40 +666,43 @@ if ($ispaymentok)
|
||||
$postactionmessages[] = 'Member '.$tmptag['MEM'].' for subscription paid was not found';
|
||||
$ispostactionok = -1;
|
||||
}
|
||||
} elseif (array_key_exists('INV', $tmptag) && $tmptag['INV'] > 0)
|
||||
{
|
||||
} elseif (array_key_exists('INV', $tmptag) && $tmptag['INV'] > 0) {
|
||||
// Record payment
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($db);
|
||||
$result = $object->fetch($tmptag['INV']);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
|
||||
$paymentTypeId = 0;
|
||||
if ($paymentmethod == 'paybox') $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'paypal') $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'stripe') $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
if (empty($paymentTypeId))
|
||||
{
|
||||
if ($paymentmethod == 'paybox') {
|
||||
$paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'paypal') {
|
||||
$paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'stripe') {
|
||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if (empty($paymentTypeId)) {
|
||||
$paymentType = $_SESSION["paymentType"];
|
||||
if (empty($paymentType)) $paymentType = 'CB';
|
||||
if (empty($paymentType)) {
|
||||
$paymentType = 'CB';
|
||||
}
|
||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||
}
|
||||
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
|
||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0)
|
||||
{
|
||||
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
|
||||
$db->begin();
|
||||
|
||||
// Creation of payment line
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->datepaye = $now;
|
||||
if ($currencyCodeType == $conf->currency)
|
||||
{
|
||||
if ($currencyCodeType == $conf->currency) {
|
||||
$paiement->amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id
|
||||
} else {
|
||||
$paiement->multicurrency_amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching
|
||||
@ -665,11 +717,9 @@ if ($ispaymentok)
|
||||
$paiement->ext_payment_id = $TRANSACTIONID;
|
||||
$paiement->ext_payment_site = $service;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
if ($paiement_id < 0) {
|
||||
$postactionmessages[] = $paiement->error.' '.join("<br>\n", $paiement->errors);
|
||||
$ispostactionok = -1;
|
||||
$error++;
|
||||
@ -679,20 +729,23 @@ if ($ispaymentok)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !empty($conf->banque->enabled))
|
||||
{
|
||||
if (!$error && !empty($conf->banque->enabled)) {
|
||||
$bankaccountid = 0;
|
||||
if ($paymentmethod == 'paybox') $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
elseif ($paymentmethod == 'paypal') $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
elseif ($paymentmethod == 'stripe') $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'paybox') {
|
||||
$bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
} elseif ($paymentmethod == 'paypal') {
|
||||
$bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
} elseif ($paymentmethod == 'stripe') {
|
||||
$bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
}
|
||||
|
||||
if ($bankaccountid > 0)
|
||||
{
|
||||
if ($bankaccountid > 0) {
|
||||
$label = '(CustomerInvoicePayment)';
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
|
||||
}
|
||||
$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$postactionmessages[] = $paiement->error.' '.join("<br>\n", $paiement->errors);
|
||||
$ispostactionok = -1;
|
||||
$error++;
|
||||
@ -707,8 +760,7 @@ if ($ispaymentok)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
@ -726,8 +778,7 @@ if ($ispaymentok)
|
||||
}
|
||||
}
|
||||
|
||||
if ($ispaymentok)
|
||||
{
|
||||
if ($ispaymentok) {
|
||||
// Get on url call
|
||||
$onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN;
|
||||
$payerID = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID;
|
||||
@ -739,26 +790,33 @@ if ($ispaymentok)
|
||||
if (is_object($object) && method_exists($object, 'call_trigger')) {
|
||||
// Call trigger
|
||||
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
||||
if ($TRANSACTIONID) print $langs->trans("ThisIsTransactionId", $TRANSACTIONID)."<br><br>\n";
|
||||
if ($TRANSACTIONID) {
|
||||
print $langs->trans("ThisIsTransactionId", $TRANSACTIONID)."<br><br>\n";
|
||||
}
|
||||
|
||||
$key = 'ONLINE_PAYMENT_MESSAGE_OK';
|
||||
if (!empty($conf->global->$key)) print $conf->global->$key;
|
||||
if (!empty($conf->global->$key)) {
|
||||
print $conf->global->$key;
|
||||
}
|
||||
|
||||
$sendemail = '';
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) {
|
||||
$sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
}
|
||||
|
||||
$tmptag = dolExplodeIntoArray($fulltag, '.', '=');
|
||||
|
||||
dol_syslog("Send email to admins if we have to (sendemail = ".$sendemail.")", LOG_DEBUG, 0, '_payment');
|
||||
|
||||
// Send an email to admins
|
||||
if ($sendemail)
|
||||
{
|
||||
if ($sendemail) {
|
||||
$companylangs = new Translate('', $conf);
|
||||
$companylangs->setDefaultLang($mysoc->default_lang);
|
||||
$companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox'));
|
||||
@ -772,26 +830,28 @@ if ($ispaymentok)
|
||||
|
||||
// Define link to login card
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli))
|
||||
{
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
} else $appli .= " ".DOL_VERSION;
|
||||
} else $appli .= " ".DOL_VERSION;
|
||||
if (preg_match('/\d\.\d/', $appli)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
||||
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
|
||||
$urlback = $_SERVER["REQUEST_URI"];
|
||||
$topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||
$content = "";
|
||||
if (array_key_exists('MEM', $tmptag))
|
||||
{
|
||||
if (array_key_exists('MEM', $tmptag)) {
|
||||
$url = $urlwithroot."/adherents/subscription.php?rowid=".$tmptag['MEM'];
|
||||
$content .= '<strong>'.$companylangs->trans("PaymentSubscription")."</strong><br><br>\n";
|
||||
$content .= $companylangs->trans("MemberId").': <strong>'.$tmptag['MEM']."</strong><br>\n";
|
||||
$content .= $companylangs->trans("Link").': <a href="'.$url.'">'.$url.'</a>'."<br>\n";
|
||||
} elseif (array_key_exists('INV', $tmptag))
|
||||
{
|
||||
} elseif (array_key_exists('INV', $tmptag)) {
|
||||
$url = $urlwithroot."/compta/facture/card.php?id=".$tmptag['INV'];
|
||||
$content .= '<strong>'.$companylangs->trans("Payment")."</strong><br><br>\n";
|
||||
$content .= $companylangs->trans("InvoiceId").': <strong>'.$tmptag['INV']."</strong><br>\n";
|
||||
@ -801,24 +861,20 @@ if ($ispaymentok)
|
||||
$content .= $companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived")."<br>\n";
|
||||
}
|
||||
$content .= $companylangs->transnoentities("PostActionAfterPayment").' : ';
|
||||
if ($ispostactionok > 0)
|
||||
{
|
||||
if ($ispostactionok > 0) {
|
||||
//$topic.=' ('.$companylangs->transnoentitiesnoconv("Status").' '.$companylangs->transnoentitiesnoconv("OK").')';
|
||||
$content .= '<font color="green">'.$companylangs->transnoentitiesnoconv("OK").'</font>';
|
||||
} elseif ($ispostactionok == 0)
|
||||
{
|
||||
} elseif ($ispostactionok == 0) {
|
||||
$content .= $companylangs->transnoentitiesnoconv("None");
|
||||
} else {
|
||||
$topic .= ($ispostactionok ? '' : ' ('.$companylangs->trans("WarningPostActionErrorAfterPayment").')');
|
||||
$content .= '<font color="red">'.$companylangs->transnoentitiesnoconv("Error").'</font>';
|
||||
}
|
||||
$content .= '<br>'."\n";
|
||||
foreach ($postactionmessages as $postactionmessage)
|
||||
{
|
||||
foreach ($postactionmessages as $postactionmessage) {
|
||||
$content .= ' * '.$postactionmessage.'<br>'."\n";
|
||||
}
|
||||
if ($ispostactionok < 0)
|
||||
{
|
||||
if ($ispostactionok < 0) {
|
||||
$content .= $langs->transnoentities("ARollbackWasPerformedOnPostActions");
|
||||
}
|
||||
$content .= '<br>'."\n";
|
||||
@ -831,10 +887,18 @@ if ($ispaymentok)
|
||||
$content .= "<br>\n";
|
||||
$content .= "tag=".$fulltag."<br>\ntoken=".$onlinetoken."<br>\npaymentType=".$paymentType."<br>\ncurrencycodeType=".$currencyCodeType."<br>\npayerId=".$payerID."<br>\nipaddress=".$ipaddress."<br>\nFinalPaymentAmt=".$FinalPaymentAmt."<br>\n";
|
||||
|
||||
if (!empty($ErrorCode)) $content .= "ErrorCode = ".$ErrorCode."<br>\n";
|
||||
if (!empty($ErrorShortMsg)) $content .= "ErrorShortMsg = ".$ErrorShortMsg."<br>\n";
|
||||
if (!empty($ErrorLongMsg)) $content .= "ErrorLongMsg = ".$ErrorLongMsg."<br>\n";
|
||||
if (!empty($ErrorSeverityCode)) $content .= "ErrorSeverityCode = ".$ErrorSeverityCode."<br>\n";
|
||||
if (!empty($ErrorCode)) {
|
||||
$content .= "ErrorCode = ".$ErrorCode."<br>\n";
|
||||
}
|
||||
if (!empty($ErrorShortMsg)) {
|
||||
$content .= "ErrorShortMsg = ".$ErrorShortMsg."<br>\n";
|
||||
}
|
||||
if (!empty($ErrorLongMsg)) {
|
||||
$content .= "ErrorLongMsg = ".$ErrorLongMsg."<br>\n";
|
||||
}
|
||||
if (!empty($ErrorSeverityCode)) {
|
||||
$content .= "ErrorSeverityCode = ".$ErrorSeverityCode."<br>\n";
|
||||
}
|
||||
|
||||
$ishtml = dol_textishtml($content); // May contain urls
|
||||
|
||||
@ -842,8 +906,7 @@ if ($ispaymentok)
|
||||
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
|
||||
|
||||
$result = $mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
||||
//dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0);
|
||||
} else {
|
||||
@ -863,7 +926,9 @@ if ($ispaymentok)
|
||||
if (is_object($object) && method_exists($object, 'call_trigger')) {
|
||||
// Call trigger
|
||||
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
@ -873,18 +938,25 @@ if ($ispaymentok)
|
||||
print $langs->trans('ErrorCode').": ".$ErrorCode."<br>\n";
|
||||
print $langs->trans('ErrorSeverityCode').": ".$ErrorSeverityCode."<br>\n";
|
||||
|
||||
if ($mysoc->email) print "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
|
||||
if ($mysoc->email) {
|
||||
print "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
|
||||
}
|
||||
|
||||
$sendemail = '';
|
||||
if (!empty($conf->global->PAYMENTONLINE_SENDEMAIL)) $sendemail = $conf->global->PAYMENTONLINE_SENDEMAIL;
|
||||
if (!empty($conf->global->PAYMENTONLINE_SENDEMAIL)) {
|
||||
$sendemail = $conf->global->PAYMENTONLINE_SENDEMAIL;
|
||||
}
|
||||
// TODO Remove local option to keep only the generic one ?
|
||||
if ($paymentmethod == 'paypal' && !empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail = $conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||
elseif ($paymentmethod == 'paybox' && !empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail = $conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||
elseif ($paymentmethod == 'stripe' && !empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail = $conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
||||
if ($paymentmethod == 'paypal' && !empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) {
|
||||
$sendemail = $conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||
} elseif ($paymentmethod == 'paybox' && !empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) {
|
||||
$sendemail = $conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||
} elseif ($paymentmethod == 'stripe' && !empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) {
|
||||
$sendemail = $conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
||||
}
|
||||
|
||||
// Send warning of error to administrator
|
||||
if ($sendemail)
|
||||
{
|
||||
if ($sendemail) {
|
||||
$companylangs = new Translate('', $conf);
|
||||
$companylangs->setDefaultLang($mysoc->default_lang);
|
||||
$companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox'));
|
||||
@ -898,14 +970,18 @@ if ($ispaymentok)
|
||||
|
||||
// Define link to login card
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli))
|
||||
{
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
} else $appli .= " ".DOL_VERSION;
|
||||
} else $appli .= " ".DOL_VERSION;
|
||||
if (preg_match('/\d\.\d/', $appli)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
||||
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
|
||||
$urlback = $_SERVER["REQUEST_URI"];
|
||||
$topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("ValidationOfPaymentFailed");
|
||||
@ -926,8 +1002,7 @@ if ($ispaymentok)
|
||||
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
|
||||
|
||||
$result = $mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
||||
} else {
|
||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
||||
|
||||
@ -27,17 +27,29 @@
|
||||
* \brief Example of form to add a new lead
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
@ -57,7 +69,9 @@ $action = GETPOST('action', 'aZ09');
|
||||
$langs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->projet->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->projet->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
if (empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
|
||||
print $langs->trans("Form for public lead registration has not been enabled");
|
||||
@ -234,7 +248,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extrafields->fetch_name_optionals_label($proj->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $proj);
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$result = $proj->create($user);
|
||||
if ($result > 0) {
|
||||
@ -257,7 +273,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->PROJECT_EMAIL_TEMPLATE_AUTOLEAD;
|
||||
|
||||
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
@ -275,9 +293,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
}
|
||||
/*if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}*/
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!empty($backtopage)) {
|
||||
@ -289,7 +307,9 @@ if (empty($reshook) && $action == 'add') {
|
||||
$urlback = $_SERVER["PHP_SELF"]."?action=added";
|
||||
}
|
||||
|
||||
if (!empty($entity)) $urlback .= '&entity='.$entity;
|
||||
if (!empty($entity)) {
|
||||
$urlback .= '&entity='.$entity;
|
||||
}
|
||||
dol_syslog("project lead ".$proj->ref." was created, we redirect to ".$urlback);
|
||||
} else {
|
||||
$error++;
|
||||
@ -414,7 +434,9 @@ if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
|
||||
if ($country_code) {
|
||||
$new_country_id = getCountry($country_code, 3, $db, $langs);
|
||||
//print 'xxx'.$country_code.' - '.$new_country_id;
|
||||
if ($new_country_id) $country_id = $new_country_id;
|
||||
if ($new_country_id) {
|
||||
$country_id = $new_country_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
$country_code = getCountry($country_id, 2, $db, $langs);
|
||||
@ -423,8 +445,11 @@ print '</td></tr>';
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($country_code) print $formcompany->select_state(GETPOST("state_id"), $country_code);
|
||||
else print '';
|
||||
if ($country_code) {
|
||||
print $formcompany->select_state(GETPOST("state_id"), $country_code);
|
||||
} else {
|
||||
print '';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// EMail
|
||||
|
||||
@ -32,8 +32,12 @@ if (!defined('NOREQUIREMENU')) {
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
// If this page is public (can be called outside logged session)
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -206,7 +210,9 @@ if ($display_ticket_list) {
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -237,8 +243,9 @@ if ($display_ticket_list) {
|
||||
$sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label";
|
||||
// Add fields for extrafields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc";
|
||||
@ -360,8 +367,7 @@ if ($display_ticket_list) {
|
||||
print_liste_field_titre($selectedfields, $url_page_current, "", '', '', 'align="right"', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date ticket
|
||||
|
||||
@ -21,10 +21,18 @@
|
||||
* \brief Public file to show on job
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php';
|
||||
@ -52,10 +60,8 @@ if (isset($_SESSION['email_customer'])) {
|
||||
|
||||
$object = new RecruitmentJobPosition($db);
|
||||
|
||||
if (!$action)
|
||||
{
|
||||
if (!$ref)
|
||||
{
|
||||
if (!$action) {
|
||||
if (!$ref) {
|
||||
print $langs->trans('ErrorBadParameters')." - ref missing";
|
||||
exit;
|
||||
} else {
|
||||
@ -73,10 +79,8 @@ $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than curren
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
if (!empty($backtopage))
|
||||
{
|
||||
if ($cancel) {
|
||||
if (!empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
@ -125,8 +129,7 @@ if ($action == "view" || $action == "presend" || $action == "close" || $action =
|
||||
|
||||
if ($error || $errors) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
if ($action == "add_message")
|
||||
{
|
||||
if ($action == "add_message") {
|
||||
$action = 'presend';
|
||||
} else {
|
||||
$action = '';
|
||||
@ -150,7 +153,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
*/
|
||||
|
||||
$head = '';
|
||||
if (!empty($conf->global->MAIN_RECRUITMENT_CSS_URL)) $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_RECRUITMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (!empty($conf->global->MAIN_RECRUITMENT_CSS_URL)) {
|
||||
$head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_RECRUITMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
}
|
||||
|
||||
$conf->dol_hide_topmenu = 1;
|
||||
$conf->dol_hide_leftmenu = 1;
|
||||
@ -188,24 +193,24 @@ print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||
$logosmall = $mysoc->logo_small;
|
||||
$logo = $mysoc->logo;
|
||||
$paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix;
|
||||
if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo;
|
||||
elseif (!empty($conf->global->ONLINE_RECRUITMENT_LOGO)) $logosmall = $conf->global->ONLINE_RECRUITMENT_LOGO_;
|
||||
if (!empty($conf->global->$paramlogo)) {
|
||||
$logosmall = $conf->global->$paramlogo;
|
||||
} elseif (!empty($conf->global->ONLINE_RECRUITMENT_LOGO)) {
|
||||
$logosmall = $conf->global->ONLINE_RECRUITMENT_LOGO_;
|
||||
}
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo = '';
|
||||
$urllogofull = '';
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
|
||||
{
|
||||
if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
|
||||
{
|
||||
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
|
||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
$urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
|
||||
}
|
||||
// Output html code for logo
|
||||
if ($urllogo)
|
||||
{
|
||||
if ($urllogo) {
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="logopublicpayment">';
|
||||
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
|
||||
@ -219,15 +224,16 @@ if ($urllogo)
|
||||
|
||||
// Output introduction text
|
||||
$text = '';
|
||||
if (!empty($conf->global->RECRUITMENT_NEWFORM_TEXT))
|
||||
{
|
||||
if (!empty($conf->global->RECRUITMENT_NEWFORM_TEXT)) {
|
||||
$langs->load("recruitment");
|
||||
if (preg_match('/^\((.*)\)$/', $conf->global->RECRUITMENT_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."<br>\n";
|
||||
else $text .= $conf->global->RECRUITMENT_NEWFORM_TEXT."<br>\n";
|
||||
if (preg_match('/^\((.*)\)$/', $conf->global->RECRUITMENT_NEWFORM_TEXT, $reg)) {
|
||||
$text .= $langs->trans($reg[1])."<br>\n";
|
||||
} else {
|
||||
$text .= $conf->global->RECRUITMENT_NEWFORM_TEXT."<br>\n";
|
||||
}
|
||||
$text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||
}
|
||||
if (empty($text))
|
||||
{
|
||||
if (empty($text)) {
|
||||
$text .= '<tr><td class="textpublicpayment"><br>'.$langs->trans("JobOfferToBeFilled", $mysoc->name);
|
||||
$text .= ' - <strong>'.$mysoc->name.'</strong>';
|
||||
$text .= ' - <span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation);
|
||||
@ -304,10 +310,8 @@ print '</div>'."\n";
|
||||
print "\n";
|
||||
|
||||
|
||||
if ($action != 'dosubmit')
|
||||
{
|
||||
if ($found && !$error) // We are in a management option and no error
|
||||
{
|
||||
if ($action != 'dosubmit') {
|
||||
if ($found && !$error) { // We are in a management option and no error
|
||||
} else {
|
||||
dol_print_error_email('ERRORNEWONLINESIGN');
|
||||
}
|
||||
|
||||
@ -17,13 +17,23 @@
|
||||
|
||||
// TODO Do we really need this page. We alread have a ipn.php page !
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
@ -39,14 +49,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
|
||||
|
||||
if (empty($conf->stripe->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->stripe->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
// You can find your endpoint's secret in your webhook settings
|
||||
if (isset($_GET['connect']))
|
||||
{
|
||||
if (isset($_GET['test']))
|
||||
{
|
||||
if (isset($_GET['connect'])) {
|
||||
if (isset($_GET['test'])) {
|
||||
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY;
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
@ -56,8 +66,7 @@ if (isset($_GET['connect']))
|
||||
$servicestatus = 1;
|
||||
}
|
||||
} else {
|
||||
if (isset($_GET['test']))
|
||||
{
|
||||
if (isset($_GET['test'])) {
|
||||
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
@ -86,7 +95,9 @@ $stripe = new Stripe($db);
|
||||
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("Stripe confirm_payment was called");
|
||||
@ -115,7 +126,7 @@ try {
|
||||
if (isset($json_obj->payment_intent_id)) {
|
||||
$intent = \Stripe\PaymentIntent::retrieve(
|
||||
$json_obj->payment_intent_id
|
||||
);
|
||||
);
|
||||
$intent->confirm();
|
||||
}
|
||||
generatePaymentResponse($intent);
|
||||
|
||||
@ -16,13 +16,23 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
@ -39,14 +49,14 @@ require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
|
||||
|
||||
|
||||
if (empty($conf->stripe->enabled)) accessforbidden('', 0, 0, 1);
|
||||
if (empty($conf->stripe->enabled)) {
|
||||
accessforbidden('', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
// You can find your endpoint's secret in your webhook settings
|
||||
if (isset($_GET['connect']))
|
||||
{
|
||||
if (isset($_GET['test']))
|
||||
{
|
||||
if (isset($_GET['connect'])) {
|
||||
if (isset($_GET['test'])) {
|
||||
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY;
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
@ -56,8 +66,7 @@ if (isset($_GET['connect']))
|
||||
$servicestatus = 1;
|
||||
}
|
||||
} else {
|
||||
if (isset($_GET['test']))
|
||||
{
|
||||
if (isset($_GET['test'])) {
|
||||
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
@ -68,8 +77,7 @@ if (isset($_GET['connect']))
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($endpoint_secret))
|
||||
{
|
||||
if (empty($endpoint_secret)) {
|
||||
print 'Error: Setup of module Stripe not complete for mode '.$service.'. The WEBHOOK_KEY is not defined.';
|
||||
http_response_code(400); // PHP 5.4 or greater
|
||||
exit();
|
||||
@ -107,18 +115,15 @@ $user = new User($db);
|
||||
$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS);
|
||||
$user->getrights();
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc))
|
||||
{
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc)) {
|
||||
$sql = "SELECT entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql .= " WHERE service = '".$db->escape($service)."' and tokenstring LIKE '%".$db->escape($event->account)."%'";
|
||||
|
||||
dol_syslog(get_class($db)."::fetch", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($db->num_rows($result))
|
||||
{
|
||||
if ($result) {
|
||||
if ($db->num_rows($result)) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$key = $obj->entity;
|
||||
} else {
|
||||
@ -135,7 +140,9 @@ $stripe = new Stripe($db);
|
||||
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("***** Stripe IPN was called with event->type = ".$event->type);
|
||||
@ -146,8 +153,7 @@ if ($event->type == 'payout.created') {
|
||||
|
||||
$result = dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$subject = $societeName.' - [NOTIFICATION] Stripe payout scheduled';
|
||||
if (!empty($user->email)) {
|
||||
$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
|
||||
@ -189,8 +195,7 @@ if ($event->type == 'payout.created') {
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$result = dolibarr_set_const($db, $service."_NEXTPAYOUT", null, 'chaine', 0, '', $conf->entity);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$langs->load("errors");
|
||||
|
||||
$dateo = dol_now();
|
||||
@ -205,8 +210,7 @@ if ($event->type == 'payout.created') {
|
||||
$accountto = new Account($db);
|
||||
$accountto->fetch($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS);
|
||||
|
||||
if (($accountto->id != $accountfrom->id) && empty($error))
|
||||
{
|
||||
if (($accountto->id != $accountfrom->id) && empty($error)) {
|
||||
$bank_line_id_from = 0;
|
||||
$bank_line_id_to = 0;
|
||||
$result = 0;
|
||||
@ -215,15 +219,31 @@ if ($event->type == 'payout.created') {
|
||||
$typefrom = 'PRE';
|
||||
$typeto = 'VIR';
|
||||
|
||||
if (!$error) $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * price2num($amount), '', '', $user);
|
||||
if (!($bank_line_id_from > 0)) $error++;
|
||||
if (!$error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amount), '', '', $user);
|
||||
if (!($bank_line_id_to > 0)) $error++;
|
||||
if (!$error) {
|
||||
$bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * price2num($amount), '', '', $user);
|
||||
}
|
||||
if (!($bank_line_id_from > 0)) {
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
$bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amount), '', '', $user);
|
||||
}
|
||||
if (!($bank_line_id_to > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
if (!($result > 0)) $error++;
|
||||
if (!$error) $result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
if (!($result > 0)) $error++;
|
||||
if (!$error) {
|
||||
$result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
}
|
||||
if (!($result > 0)) {
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
$result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
}
|
||||
if (!($result > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$subject = $societeName.' - [NOTIFICATION] Stripe payout done';
|
||||
@ -252,7 +272,7 @@ if ($event->type == 'payout.created') {
|
||||
'',
|
||||
0,
|
||||
-1
|
||||
);
|
||||
);
|
||||
|
||||
$ret = $mailfile->sendfile();
|
||||
|
||||
@ -279,8 +299,7 @@ if ($event->type == 'payout.created') {
|
||||
// TODO: Redirect to paymentok.php
|
||||
} elseif ($event->type == 'payment_intent.payment_failed') {
|
||||
// TODO: Redirect to paymentko.php
|
||||
} elseif ($event->type == 'checkout.session.completed') // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on).
|
||||
{
|
||||
} elseif ($event->type == 'checkout.session.completed') { // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on).
|
||||
// TODO: create fees
|
||||
// TODO: Redirect to paymentok.php
|
||||
} elseif ($event->type == 'payment_method.attached') {
|
||||
@ -291,8 +310,7 @@ if ($event->type == 'payout.created') {
|
||||
$companypaymentmode = new CompanyPaymentMode($db);
|
||||
|
||||
$idthirdparty = $societeaccount->getThirdPartyID($db->escape($event->data->object->customer), 'stripe', $servicestatus);
|
||||
if ($idthirdparty > 0) // If the payment mode is on an external customer that is known in societeaccount, we can create the payment mode
|
||||
{
|
||||
if ($idthirdparty > 0) { // If the payment mode is on an external customer that is known in societeaccount, we can create the payment mode
|
||||
$companypaymentmode->stripe_card_ref = $db->escape($event->data->object->id);
|
||||
$companypaymentmode->fk_soc = $idthirdparty;
|
||||
$companypaymentmode->bank = null;
|
||||
@ -311,16 +329,13 @@ if ($event->type == 'payout.created') {
|
||||
$companypaymentmode->status = $servicestatus;
|
||||
|
||||
$db->begin();
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$result = $companypaymentmode->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
@ -345,16 +360,13 @@ if ($event->type == 'payout.created') {
|
||||
$companypaymentmode->status = $servicestatus;
|
||||
|
||||
$db->begin();
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$result = $companypaymentmode->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
@ -1,11 +1,25 @@
|
||||
<?php
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', 1);
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1);
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', 1);
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOSESSION')) {
|
||||
define('NOSESSION', '1');
|
||||
}
|
||||
|
||||
session_cache_limiter('public');
|
||||
|
||||
@ -20,7 +34,7 @@ if ($dolibarr_main_prod) {
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="Documentation and examples for theme.">
|
||||
|
||||
@ -29,10 +43,10 @@ if ($dolibarr_main_prod) {
|
||||
<body class="docpage" style="padding: 20px;">
|
||||
|
||||
<main role="main" >
|
||||
<h1 class="bd-title" id="content">Badges</h1>
|
||||
<p class="bd-lead">Documentation and examples for badges, our small count and labeling component.</p>
|
||||
<h1 class="bd-title" id="content">Badges</h1>
|
||||
<p class="bd-lead">Documentation and examples for badges, our small count and labeling component.</p>
|
||||
|
||||
<h2 id="example">Example</h2>
|
||||
<h2 id="example">Example</h2>
|
||||
|
||||
<p>Badges scale to match the size of the immediate parent element by using relative font sizing and em units.</p>
|
||||
|
||||
@ -46,7 +60,7 @@ if ($dolibarr_main_prod) {
|
||||
</div>
|
||||
|
||||
<figure class="highlight">
|
||||
<pre>
|
||||
<pre>
|
||||
|
||||
<h1>Example heading <span class="badge badge-secondary">New</span></h1>
|
||||
<h2>Example heading <span class="badge badge-secondary">New</span></h2>
|
||||
@ -55,7 +69,7 @@ if ($dolibarr_main_prod) {
|
||||
<h5>Example heading <span class="badge badge-secondary">New</span></h5>
|
||||
<h6>Example heading <span class="badge badge-secondary">New</span></h6>
|
||||
|
||||
</pre>
|
||||
</pre>
|
||||
</figure>
|
||||
|
||||
<p>Badges can be used as part of links or buttons to provide a counter.</p>
|
||||
@ -88,7 +102,7 @@ if ($dolibarr_main_prod) {
|
||||
</div>
|
||||
|
||||
<figure class="highlight">
|
||||
<pre>
|
||||
<pre>
|
||||
|
||||
|
||||
<button type="button" class="btn btn-primary">
|
||||
@ -97,7 +111,7 @@ if ($dolibarr_main_prod) {
|
||||
</button>
|
||||
|
||||
|
||||
</pre>
|
||||
</pre>
|
||||
</figure>
|
||||
|
||||
<h2 id="contextual-variations">Contextual variations</h2>
|
||||
@ -117,7 +131,7 @@ if ($dolibarr_main_prod) {
|
||||
</div>
|
||||
|
||||
<figure class="highlight">
|
||||
<pre>
|
||||
<pre>
|
||||
|
||||
<span class="badge badge-primary">Primary</span>
|
||||
<span class="badge badge-secondary">Secondary</span>
|
||||
@ -128,7 +142,7 @@ if ($dolibarr_main_prod) {
|
||||
<span class="badge badge-light">Light</span>
|
||||
<span class="badge badge-dark">Dark</span>
|
||||
|
||||
</pre>
|
||||
</pre>
|
||||
</figure>
|
||||
|
||||
<div class="warning">
|
||||
@ -144,13 +158,13 @@ if ($dolibarr_main_prod) {
|
||||
<p>Add any of the below mentioned modifier classes to change the appearance of a badge to be linked to a default status.</p>
|
||||
|
||||
<div class="bd-example">
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<span class="badge badge-status<?php print $i; ?>" >status-<?php print $i; ?></span>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
|
||||
<figure class="highlight"><pre><pre>
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<span class="badge badge-status<?php print $i; ?>" >status<?php print $i; ?></span>
|
||||
<?php endfor; ?>
|
||||
</pre></figure>
|
||||
@ -171,7 +185,7 @@ if ($dolibarr_main_prod) {
|
||||
<span class="badge badge-pill badge-light">Light</span>
|
||||
<span class="badge badge-pill badge-dark">Dark</span>
|
||||
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<span class="badge badge-pill badge-status<?php print $i; ?>" >status<?php print $i; ?></span>
|
||||
<?php endfor; ?>
|
||||
|
||||
@ -188,7 +202,7 @@ if ($dolibarr_main_prod) {
|
||||
<span class="badge badge-pill badge-info">Info</span>
|
||||
<span class="badge badge-pill badge-light">Light</span>
|
||||
<span class="badge badge-pill badge-dark">Dark</span>
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<span class="badge badge-pill badge-status<?php print $i; ?>" >status<?php print $i; ?></span>
|
||||
<?php endfor; ?>
|
||||
</pre></figure>
|
||||
@ -210,7 +224,7 @@ if ($dolibarr_main_prod) {
|
||||
<span class="badge badge-dot badge-light"></span>
|
||||
<span class="badge badge-dot badge-dark"></span>
|
||||
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<span class="badge badge-dot badge-status<?php print $i; ?>" ></span>
|
||||
<?php endfor; ?>
|
||||
|
||||
@ -227,7 +241,7 @@ if ($dolibarr_main_prod) {
|
||||
<span class="badge badge-dot badge-info"></span>
|
||||
<span class="badge badge-dot badge-light"></span>
|
||||
<span class="badge badge-dot badge-dark"></span>
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<span class="badge badge-dot badge-status<?php print $i; ?>" ></span>
|
||||
<?php endfor; ?>
|
||||
</pre></figure>
|
||||
@ -256,7 +270,7 @@ if ($dolibarr_main_prod) {
|
||||
<a href="#" class="badge badge-info">Info</a>
|
||||
<a href="#" class="badge badge-light">Light</a>
|
||||
<a href="#" class="badge badge-dark">Dark</a>
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<a href="#" class="badge badge-status<?php print $i; ?>" >status<?php print $i; ?></a>
|
||||
<?php endfor; ?>
|
||||
|
||||
@ -271,7 +285,7 @@ if ($dolibarr_main_prod) {
|
||||
<a href="#" class="badge badge-info">Info</a>
|
||||
<a href="#" class="badge badge-light">Light</a>
|
||||
<a href="#" class="badge badge-dark">Dark</a>
|
||||
<?php for ($i = 0; $i <= 9; $i++): ?>
|
||||
<?php for ($i = 0; $i <= 9; $i++) : ?>
|
||||
<a href="#" class="badge badge-status<?php print $i; ?>" >status<?php print $i; ?></a>
|
||||
<?php endfor; ?>
|
||||
</pre></figure>
|
||||
@ -326,7 +340,7 @@ if ($dolibarr_main_prod) {
|
||||
</pre></figure>
|
||||
|
||||
|
||||
</main>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -2,15 +2,25 @@
|
||||
//define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||
//if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
|
||||
//if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
//if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (!defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
if (!defined('NOSTYLECHECK')) {
|
||||
define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
}
|
||||
//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
//if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
//if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
||||
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
}
|
||||
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -29,8 +39,7 @@ $form = new Form($db);
|
||||
// HEADER
|
||||
//--------
|
||||
|
||||
if (empty($usedolheader))
|
||||
{
|
||||
if (empty($usedolheader)) {
|
||||
header("Content-type: text/html; charset=UTF8");
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
@ -75,7 +84,7 @@ if (empty($usedolheader))
|
||||
'/includes/pdfmake/pdfmake.min.js',
|
||||
'/includes/pdfmake/vfs_fonts.js'
|
||||
);
|
||||
*/
|
||||
*/
|
||||
|
||||
llxHeader('', '', '', '', 0, 0, $arrayjs, $arraycss);
|
||||
}
|
||||
@ -125,14 +134,14 @@ This page is a sample of page using tables. It is designed to make test with<br>
|
||||
<br><hr><br>Example 0c: Table with table+tr+td containg a select that should be overflowed and truncated => Use this to align text or form<br>
|
||||
|
||||
<table class="centpercent">
|
||||
<tr>
|
||||
<td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
|
||||
<tr>
|
||||
<td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
|
||||
<select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
|
||||
</td>
|
||||
<td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
|
||||
</td>
|
||||
<td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
|
||||
<select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -144,16 +153,16 @@ This page is a sample of page using tables. It is designed to make test with<br>
|
||||
<script type="text/javascript" language="javascript">
|
||||
/*jQuery(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
var table = $('#tablelines3').DataTable( {
|
||||
scrollY: "300px",
|
||||
scrollX: true,
|
||||
scrollCollapse: true,
|
||||
paging: false,
|
||||
fixedColumns: {
|
||||
leftColumns: 1,
|
||||
rightColumns: 1
|
||||
}
|
||||
} );
|
||||
var table = $('#tablelines3').DataTable( {
|
||||
scrollY: "300px",
|
||||
scrollX: true,
|
||||
scrollCollapse: true,
|
||||
paging: false,
|
||||
fixedColumns: {
|
||||
leftColumns: 1,
|
||||
rightColumns: 1
|
||||
}
|
||||
} );
|
||||
} );
|
||||
});*/
|
||||
</script>
|
||||
@ -169,19 +178,39 @@ $sortfield = 'aaa';
|
||||
$sortorder = 'ASC';
|
||||
$tasksarray = array(1, 2, 3); // To force having several lines
|
||||
$tagidfortablednd = 'tablelines3';
|
||||
if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
|
||||
$nav = '';
|
||||
$nav .= '<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
if ($actioncode || GETPOSTISSET('actioncode')) $nav .= '<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
if ($status || GETPOSTISSET('status')) $nav .= '<input type="hidden" name="status" value="'.$status.'">';
|
||||
if ($filter) $nav .= '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
if ($filtert) $nav .= '<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
if ($socid) $nav .= '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
if ($showbirthday) $nav .= '<input type="hidden" name="showbirthday" value="1">';
|
||||
if ($pid) $nav .= '<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||
if ($type) $nav .= '<input type="hidden" name="type" value="'.$type.'">';
|
||||
if ($usergroup) $nav .= '<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
if ($actioncode || GETPOSTISSET('actioncode')) {
|
||||
$nav .= '<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
}
|
||||
if ($status || GETPOSTISSET('status')) {
|
||||
$nav .= '<input type="hidden" name="status" value="'.$status.'">';
|
||||
}
|
||||
if ($filter) {
|
||||
$nav .= '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
}
|
||||
if ($filtert) {
|
||||
$nav .= '<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
}
|
||||
if ($socid) {
|
||||
$nav .= '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
}
|
||||
if ($showbirthday) {
|
||||
$nav .= '<input type="hidden" name="showbirthday" value="1">';
|
||||
}
|
||||
if ($pid) {
|
||||
$nav .= '<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||
}
|
||||
if ($type) {
|
||||
$nav .= '<input type="hidden" name="type" value="'.$type.'">';
|
||||
}
|
||||
if ($usergroup) {
|
||||
$nav .= '<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
}
|
||||
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav .= '</form>';
|
||||
@ -213,8 +242,7 @@ $cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2
|
||||
$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters = array();
|
||||
@ -249,18 +277,18 @@ if (!empty($moreforfilter))
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#idtableexample2').dataTable( {
|
||||
<?php
|
||||
$('#idtableexample2').dataTable( {
|
||||
<?php
|
||||
if ($optioncss == 'print') {
|
||||
print '\'dom\': \'lfrtip\',';
|
||||
print '\'dom\': \'lfrtip\',';
|
||||
} else {
|
||||
print '\'dom\': \'Blfrtip\',';
|
||||
}
|
||||
?>
|
||||
"colReorder": true,
|
||||
"colReorder": true,
|
||||
'buttons': [
|
||||
'colvis','copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
'colvis','copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
"sPaginationType": "full_numbers",
|
||||
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "<?php echo $langs->trans('All'); ?>"]],
|
||||
"oLanguage": {
|
||||
@ -284,10 +312,10 @@ $(document).ready(function(){
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "../ajax.php",
|
||||
"aoColumnDefs": [
|
||||
{ "bSortable": false, "aTargets": [ 2,3,4 ] }
|
||||
],
|
||||
{ "bSortable": false, "aTargets": [ 2,3,4 ] }
|
||||
],
|
||||
*/
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
-->
|
||||
@ -299,54 +327,55 @@ $(document).ready(function(){
|
||||
<?php
|
||||
$tasksarray = array(1, 2, 3); // To force having several lines
|
||||
$tagidfortablednd = 'tablelines';
|
||||
if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
?>
|
||||
<div class="tagtable centpercent liste_titre_bydiv" id="tablelines">
|
||||
<div class="tagtr liste_titre">
|
||||
<div class="tagtd">Title A<input type="hidden" name="cartitem" value="3"></div>
|
||||
<div class="tagtd">title B</div>
|
||||
<div class="tagtd">title C</div>
|
||||
<div class="tagtd">title D</div>
|
||||
</div>
|
||||
<div class="pair tagtr">
|
||||
<div class="tagtd">line4<input type="hidden" name="cartitem" value="3"></div>
|
||||
<div class="tagtd">dfsdf</div>
|
||||
<div class="tagtd"><input name="count" value="4" class="maxwidth50"></div>
|
||||
<div class="tagtd tdlineupdown">bbbb</div>
|
||||
</div>
|
||||
<div class="impair tagtr">
|
||||
<div class="tagtd">line5<input type="hidden" name="cartitemb" value="3"></div>
|
||||
<div class="tagtd">dfsdf</div>
|
||||
<div class="tagtd"><input name="countb" value="4" class="maxwidth50"></div>
|
||||
<div class="tagtd tdlineupdown">bbbb</div>
|
||||
</div>
|
||||
<div class="pair tagtr">
|
||||
<div class="tagtd">line6<input type="hidden" name="cartitem" value="3"></div>
|
||||
<div class="tagtd">jghjgh</div>
|
||||
<div class="tagtd">5</div>
|
||||
<div class="tagtd tdlineupdown">lll</div>
|
||||
</div>
|
||||
<div class="tagtr liste_titre">
|
||||
<div class="tagtd">Title A<input type="hidden" name="cartitem" value="3"></div>
|
||||
<div class="tagtd">title B</div>
|
||||
<div class="tagtd">title C</div>
|
||||
<div class="tagtd">title D</div>
|
||||
</div>
|
||||
<div class="pair tagtr">
|
||||
<div class="tagtd">line4<input type="hidden" name="cartitem" value="3"></div>
|
||||
<div class="tagtd">dfsdf</div>
|
||||
<div class="tagtd"><input name="count" value="4" class="maxwidth50"></div>
|
||||
<div class="tagtd tdlineupdown">bbbb</div>
|
||||
</div>
|
||||
<div class="impair tagtr">
|
||||
<div class="tagtd">line5<input type="hidden" name="cartitemb" value="3"></div>
|
||||
<div class="tagtd">dfsdf</div>
|
||||
<div class="tagtd"><input name="countb" value="4" class="maxwidth50"></div>
|
||||
<div class="tagtd tdlineupdown">bbbb</div>
|
||||
</div>
|
||||
<div class="pair tagtr">
|
||||
<div class="tagtd">line6<input type="hidden" name="cartitem" value="3"></div>
|
||||
<div class="tagtd">jghjgh</div>
|
||||
<div class="tagtd">5</div>
|
||||
<div class="tagtd tdlineupdown">lll</div>
|
||||
</div>
|
||||
<!-- Using form into div make Firefox crazy (page loading does not end) -->
|
||||
<!-- <form class="liste_titre" method="POST" action="1.php">
|
||||
<div>line1<input type="hidden" name="cartitem" value="1"></div>
|
||||
<div><label><input type="checkbox" name="hidedetails" value="2"> A checkbox inside a cell</label></div>
|
||||
<div><input name="count" value="4"></div>
|
||||
<div><input type="submit" name="count2" class="button noshadow" value="aaa"></div>
|
||||
</form>
|
||||
<form class="impair" method="POST" action="2.php">
|
||||
<div>line2<input type="hidden" name="cartitem" value="2"></div>
|
||||
<div><select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select></div>
|
||||
<div><input name="countb" value="4"></div>
|
||||
<div class="tdlineupdown"><input type="submit" value="xxx" class="button"></div>
|
||||
</form>-->
|
||||
<div>line1<input type="hidden" name="cartitem" value="1"></div>
|
||||
<div><label><input type="checkbox" name="hidedetails" value="2"> A checkbox inside a cell</label></div>
|
||||
<div><input name="count" value="4"></div>
|
||||
<div><input type="submit" name="count2" class="button noshadow" value="aaa"></div>
|
||||
</form>
|
||||
<form class="impair" method="POST" action="2.php">
|
||||
<div>line2<input type="hidden" name="cartitem" value="2"></div>
|
||||
<div><select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select></div>
|
||||
<div><input name="countb" value="4"></div>
|
||||
<div class="tdlineupdown"><input type="submit" value="xxx" class="button"></div>
|
||||
</form>-->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if (!empty($usedolheader))
|
||||
{
|
||||
if (!empty($usedolheader)) {
|
||||
llxFooter();
|
||||
} else { ?>
|
||||
</body>
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
//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.
|
||||
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
||||
if (!defined('NOSESSION')) {
|
||||
define('NOSESSION', '1');
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
@ -1,21 +1,45 @@
|
||||
<?php
|
||||
if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
|
||||
if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (!defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
||||
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
if (!defined('NOREQUIREUSER')) {
|
||||
define('NOREQUIREUSER', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREDB')) {
|
||||
define('NOREQUIREDB', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRETRAN')) {
|
||||
define('NOREQUIRETRAN', '1');
|
||||
}
|
||||
if (!defined('NOSTYLECHECK')) {
|
||||
define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
||||
}
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
}
|
||||
// If you don't need session management (can't be logged if no session used). You must also set
|
||||
// NOCSRFCHECK, NOTOKENRENEWAL, NOLOGIN
|
||||
// Disable module with GETPOST('disablemodules') won't work. Variable 'dol_...' will not be set.
|
||||
// $_SESSION are then simple vars if sessions are not active.
|
||||
// TODO We can close session with session_write_close() as soon as we just need read access everywhere in code.
|
||||
if (!defined("NOSESSION")) define("NOSESSION", '1');
|
||||
if (!defined("NOSESSION")) {
|
||||
define("NOSESSION", '1');
|
||||
}
|
||||
|
||||
print "Legend:<br>\n";
|
||||
print 'PHP_SESSION_DISABLED='.PHP_SESSION_DISABLED."<br>\n";
|
||||
|
||||
@ -22,14 +22,30 @@
|
||||
* \brief Display public form to add new ticket
|
||||
*/
|
||||
|
||||
if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOREQUIREUSER')) {
|
||||
define('NOREQUIREUSER', '1');
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -22,17 +22,29 @@
|
||||
* \brief Public page to add and manage ticket
|
||||
*/
|
||||
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
// For MultiCompany module.
|
||||
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
|
||||
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
if (is_numeric($entity)) {
|
||||
define("DOLENTITY", $entity);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
|
||||
@ -57,8 +69,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
$form = new Form($db);
|
||||
$formticket = new FormTicket($db);
|
||||
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
{
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print $langs->trans('TicketPublicInterfaceForbidden');
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -32,8 +32,12 @@ if (!defined('NOREQUIREMENU')) {
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
// If this page is public (can be called outside logged session)
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -174,8 +178,7 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
print '<div class="ticketpublicarealist">';
|
||||
|
||||
if ($action == "view_ticketlist")
|
||||
{
|
||||
if ($action == "view_ticketlist") {
|
||||
print '<br>';
|
||||
if ($display_ticket_list) {
|
||||
// Filters
|
||||
@ -295,7 +298,9 @@ if ($action == "view_ticketlist")
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -326,8 +331,9 @@ if ($action == "view_ticketlist")
|
||||
$sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label";
|
||||
// Add fields for extrafields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code";
|
||||
@ -528,8 +534,7 @@ if ($action == "view_ticketlist")
|
||||
print_liste_field_titre($selectedfields, $url_page_current, "", '', '', 'align="right"', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date ticket
|
||||
|
||||
@ -33,8 +33,12 @@ if (!defined('NOREQUIREMENU')) {
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
// If this page is public (can be called outside logged session)
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -69,10 +73,8 @@ $object = new ActionsTicket($db);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
if (!empty($backtopage))
|
||||
{
|
||||
if ($cancel) {
|
||||
if (!empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
@ -104,13 +106,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
if ($ret && $object->dao->id > 0) {
|
||||
// Check if emails provided is the one of author
|
||||
$emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2);
|
||||
if ($emailofticket == $email)
|
||||
{
|
||||
if ($emailofticket == $email) {
|
||||
$display_ticket = true;
|
||||
$_SESSION['email_customer'] = $email;
|
||||
}
|
||||
// Check if emails provided is inside list of contacts
|
||||
else {
|
||||
} else {
|
||||
// Check if emails provided is inside list of contacts
|
||||
$contacts = $object->dao->liste_contact(-1, 'external');
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['email'] == $email) {
|
||||
@ -131,8 +131,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
}
|
||||
}
|
||||
// Check if email is email of creator
|
||||
if ($object->dao->fk_user_create > 0)
|
||||
{
|
||||
if ($object->dao->fk_user_create > 0) {
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($object->dao->fk_user_create);
|
||||
if ($email == $tmpuser->email) {
|
||||
@ -141,8 +140,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
}
|
||||
}
|
||||
// Check if email is email of creator
|
||||
if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create)
|
||||
{
|
||||
if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create) {
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($object->dao->fk_user_assign);
|
||||
if ($email == $tmpuser->email) {
|
||||
@ -157,8 +155,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && $action == 'confirm_public_close' && $display_ticket)
|
||||
{
|
||||
if (!$error && $action == 'confirm_public_close' && $display_ticket) {
|
||||
if ($object->dao->close($user)) {
|
||||
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
||||
|
||||
@ -171,24 +168,21 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message'))
|
||||
{
|
||||
if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message')) {
|
||||
// TODO Add message...
|
||||
$ret = $object->dao->newMessage($user, $action, 0, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$action = 'view_ticket';
|
||||
}
|
||||
}
|
||||
|
||||
if ($error || $errors) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
if ($action == "add_message")
|
||||
{
|
||||
if ($action == "add_message") {
|
||||
$action = 'presend';
|
||||
} else {
|
||||
$action = '';
|
||||
@ -228,8 +222,7 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
print '<div class="ticketpublicarea">';
|
||||
|
||||
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") {
|
||||
if ($display_ticket)
|
||||
{
|
||||
if ($display_ticket) {
|
||||
// Confirmation close
|
||||
if ($action == 'close') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
|
||||
|
||||
@ -30,14 +30,30 @@
|
||||
* \brief Wrapper to output pages when website is powered by Dolibarr instead of a native web server
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1);
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1);
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Header empty
|
||||
@ -69,18 +85,15 @@ $accessallowed = 1;
|
||||
$type = '';
|
||||
|
||||
|
||||
if (empty($pageid))
|
||||
{
|
||||
if (empty($pageid)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||
|
||||
$object = new Website($db);
|
||||
$object->fetch(0, $websitekey);
|
||||
|
||||
if (empty($object->id))
|
||||
{
|
||||
if (empty($pageid))
|
||||
{
|
||||
if (empty($object->id)) {
|
||||
if (empty($pageid)) {
|
||||
// Return header 404
|
||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
|
||||
|
||||
@ -91,57 +104,52 @@ if (empty($pageid))
|
||||
|
||||
$objectpage = new WebsitePage($db);
|
||||
|
||||
if ($pageref)
|
||||
{
|
||||
if ($pageref) {
|
||||
$result = $objectpage->fetch(0, $object->id, $pageref);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$pageid = $objectpage->id;
|
||||
} elseif ($result == 0)
|
||||
{
|
||||
} elseif ($result == 0) {
|
||||
// Page not found from ref=pageurl, we try using alternative alias
|
||||
$result = $objectpage->fetch(0, $object->id, null, $pageref);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$pageid = $objectpage->id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($object->fk_default_home > 0)
|
||||
{
|
||||
if ($object->fk_default_home > 0) {
|
||||
$result = $objectpage->fetch($object->fk_default_home);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$pageid = $objectpage->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($pageid))
|
||||
{
|
||||
if (empty($pageid)) {
|
||||
$array = $objectpage->fetchAll($object->id); // TODO Can filter on container of type pages only ?
|
||||
if (is_array($array) && count($array) > 0)
|
||||
{
|
||||
if (is_array($array) && count($array) > 0) {
|
||||
$firstrep = reset($array);
|
||||
$pageid = $firstrep->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($pageid))
|
||||
{
|
||||
if (empty($pageid)) {
|
||||
// Return header 404
|
||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
|
||||
|
||||
$langs->load("website");
|
||||
|
||||
if (!GETPOSTISSET('pageref')) print $langs->trans("PreviewOfSiteNotYetAvailable", $websitekey);
|
||||
if (!GETPOSTISSET('pageref')) {
|
||||
print $langs->trans("PreviewOfSiteNotYetAvailable", $websitekey);
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/public/error-404.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -155,8 +163,7 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_
|
||||
// Security: Delete string ../ into $original_file
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
if ($pageid == 'css') // No more used ?
|
||||
{
|
||||
if ($pageid == 'css') { // No more used ?
|
||||
header('Content-type: text/css');
|
||||
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||
@ -172,16 +179,14 @@ $refname = basename(dirname($original_file)."/");
|
||||
|
||||
// Security:
|
||||
// Limite acces si droits non corrects
|
||||
if (!$accessallowed)
|
||||
{
|
||||
if (!$accessallowed) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Security:
|
||||
// On interdit les remontees de repertoire ainsi que les pipe dans
|
||||
// les noms de fichiers.
|
||||
if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file))
|
||||
{
|
||||
if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
|
||||
dol_syslog("Refused to deliver file ".$original_file);
|
||||
$file = basename($original_file); // Do no show plain path of original_file in shown error message
|
||||
dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file));
|
||||
@ -197,8 +202,7 @@ dol_syslog("index.php include $original_file $filename content-type=$type");
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
// This test if file exists should be useless. We keep it to find bug more easily
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
if (!file_exists($original_file_osencoded)) {
|
||||
// Return header 404
|
||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
|
||||
|
||||
@ -215,4 +219,6 @@ define('USEDOLIBARRSERVER', 1);
|
||||
print '<!-- Page content '.$original_file.' rendered with DOLIBARR SERVER : Html with CSS link and html header + Body that was saved into tpl dir -->'."\n";
|
||||
include_once $original_file_osencoded; // Note: The pageXXX.tpl.php showed here contains a formatage with dolWebsiteOutput() at end of page.
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
if (is_object($db)) {
|
||||
$db->close();
|
||||
}
|
||||
|
||||
@ -21,14 +21,30 @@
|
||||
* \brief Page to output style page. Called with <link rel="stylesheet" href="styles.css.php?websiteid=123" type="text/css" />
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
if (!defined('NOLOGIN')) define("NOLOGIN", 1);
|
||||
if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define("NOLOGIN", 1);
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOIPCHECK')) {
|
||||
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
}
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', '1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Header empty
|
||||
@ -65,18 +81,18 @@ $type = '';
|
||||
*/
|
||||
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
}
|
||||
|
||||
//print 'Directory with '.$appli.' websites.<br>';
|
||||
|
||||
if (empty($pageid))
|
||||
{
|
||||
if (empty($pageid)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||
|
||||
$object = new Website($db);
|
||||
if ($websiteid)
|
||||
{
|
||||
if ($websiteid) {
|
||||
$object->fetch($websiteid);
|
||||
$website = $object->ref;
|
||||
} else {
|
||||
@ -85,21 +101,21 @@ if (empty($pageid))
|
||||
|
||||
$objectpage = new WebsitePage($db);
|
||||
/* Not required for CSS file
|
||||
$array=$objectpage->fetchAll($object->id);
|
||||
$array=$objectpage->fetchAll($object->id);
|
||||
|
||||
if (is_array($array) && count($array) > 0)
|
||||
{
|
||||
$firstrep=reset($array);
|
||||
$pageid=$firstrep->id;
|
||||
}
|
||||
*/
|
||||
if (is_array($array) && count($array) > 0)
|
||||
{
|
||||
$firstrep=reset($array);
|
||||
$pageid=$firstrep->id;
|
||||
}
|
||||
*/
|
||||
}
|
||||
/* Not required for CSS file
|
||||
if (empty($pageid))
|
||||
{
|
||||
$langs->load("website");
|
||||
print $langs->trans("PreviewOfSiteNotYetAvailable");
|
||||
exit;
|
||||
$langs->load("website");
|
||||
print $langs->trans("PreviewOfSiteNotYetAvailable");
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
@ -113,16 +129,14 @@ $refname = basename(dirname($original_file)."/");
|
||||
|
||||
// Security:
|
||||
// Limite acces si droits non corrects
|
||||
if (!$accessallowed)
|
||||
{
|
||||
if (!$accessallowed) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Security:
|
||||
// On interdit les remontees de repertoire ainsi que les pipe dans
|
||||
// les noms de fichiers.
|
||||
if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file))
|
||||
{
|
||||
if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
|
||||
dol_syslog("Refused to deliver file ".$original_file);
|
||||
$file = basename($original_file); // Do no show plain path of original_file in shown error message
|
||||
dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file));
|
||||
@ -138,8 +152,7 @@ dol_syslog("styles.css.php include $original_file $filename content-type=$type")
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
// This test if file exists should be useless. We keep it to find bug more easily
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
if (!file_exists($original_file_osencoded)) {
|
||||
$langs->load("website");
|
||||
print $langs->trans("RequestedPageHasNoContentYet", $pageid);
|
||||
//dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
|
||||
@ -153,4 +166,6 @@ print '/* Page content '.$original_file.' : CSS content that was saved into tpl
|
||||
require_once $original_file_osencoded;
|
||||
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
if (is_object($db)) {
|
||||
$db->close();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user