Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-11-14 00:52:25 +01:00
commit 98b227bdc9
6 changed files with 73 additions and 59 deletions

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1564,7 +1564,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} else {
if ($object->user_id) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
$linkeduser = new User($db);
$linkeduser->fetch($object->user_id);
print $linkeduser->getNomUrl(-1);
} else {
print $langs->trans("NoDolibarrAccess");
}

View File

@ -101,7 +101,7 @@ class SimpleOpenID
/**
* SetRequiredFields
*
* @param string $a Server
* @param string|array $a Server
* @return void
*/
public function SetRequiredFields($a)
@ -118,7 +118,7 @@ class SimpleOpenID
/**
* SetOptionalFields
*
* @param string $a Server
* @param string|array $a Server
* @return void
*/
public function SetOptionalFields($a)

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -41,14 +41,13 @@ $cancel = GETPOST('cancel', 'alpha');
$numsondage = '';
if (GETPOST('id')) {
$numsondage = GETPOST('id', 'alpha');
$numsondage = (string) GETPOST('id', 'alpha');
}
$object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage);
if ($result <= 0)
{
if ($result <= 0) {
dol_print_error($db, $object->error);
exit;
}
@ -112,17 +111,16 @@ if (empty($reshook))
if (!$error)
{
$object->title = GETPOST('nouveautitre', 'nohtml');
$object->description = GETPOST('nouveauxcommentaires', 'restricthtml');
$object->mail_admin = GETPOST('nouvelleadresse', 'alpha');
$object->title = (string) GETPOST('nouveautitre', 'alphanohtml');
$object->description = (string) GETPOST('nouveauxcommentaires', 'restricthtml');
$object->mail_admin = (string) GETPOST('nouvelleadresse', 'alpha');
$object->date_fin = $expiredate;
$object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0;
$object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0;
$object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false;
$object->allow_comments = GETPOST('cancomment', 'aZ09') == 'on' ? 1 : 0;
$object->allow_spy = GETPOST('canseeothersvote', 'aZ09') == 'on' ? 1 : 0;
$object->mailsonde = GETPOST('mailsonde', 'aZ09') == 'on' ? true : false;
$res = $object->update($user);
if ($res < 0)
{
if ($res < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -49,7 +50,6 @@ class Opensurveysondage extends CommonObject
*/
public $picto = 'poll';
/**
* @var string ID survey
*/
@ -60,7 +60,14 @@ class Opensurveysondage extends CommonObject
*/
public $description;
/**
* @var string email admin
*/
public $mail_admin;
/**
* @var admin name
*/
public $nom_admin;
/**
@ -75,10 +82,25 @@ class Opensurveysondage extends CommonObject
public $title;
public $date_fin = '';
/**
* @var int status
*/
public $status = 1;
/**
* @var string format of survey
*/
public $format;
/**
* @var int mailsonde
*/
public $mailsonde;
/**
* @var string subject
*/
public $sujet;
/**
@ -133,8 +155,7 @@ class Opensurveysondage extends CommonObject
$this->cleanParameters();
// Check parameters
if (!$this->date_fin > 0)
{
if (!$this->date_fin > 0) {
$this->error = 'BadValueForEndDate';
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1;
@ -156,10 +177,10 @@ class Opensurveysondage extends CommonObject
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->id_sondage)."',";
$sql .= " ".(empty($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").",";
$sql .= " ".$user->id.",";
$sql .= " ".(int) $user->id.",";
$sql .= " '".$this->db->escape($this->title)."',";
$sql .= " '".$this->db->idate($this->date_fin)."',";
$sql .= " ".$this->status.",";
$sql .= " ".(int) $this->status.",";
$sql .= " '".$this->db->escape($this->format)."',";
$sql .= " ".$this->db->escape($this->mailsonde).",";
$sql .= " ".$this->db->escape($this->allow_comments).",";
@ -173,24 +194,18 @@ class Opensurveysondage extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
if (!$error)
{
if (!$notrigger)
{
global $langs, $conf;
if (!$error && !$notrigger) {
global $langs, $conf;
// Call trigger
$result = $this->call_trigger('OPENSURVEY_CREATE', $user);
if ($result < 0) $error++;
// End call triggers
}
// Call trigger
$result = $this->call_trigger('OPENSURVEY_CREATE', $user);
if ($result < 0) $error++;
// End call triggers
}
// Commit or rollback
if ($error)
{
foreach ($this->errors as $errmsg)
{
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
@ -310,10 +325,12 @@ class Opensurveysondage extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
if (!$resql) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error && !$notrigger)
{
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('OPENSURVEY_MODIFY', $user);
if ($result < 0) $error++;
@ -356,15 +373,11 @@ class Opensurveysondage extends CommonObject
$this->db->begin();
if (!$error)
{
if (!$notrigger)
{
// Call trigger
$result = $this->call_trigger('OPENSURVEY_DELETE', $user);
if ($result < 0) $error++;
// End call triggers
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('OPENSURVEY_DELETE', $user);
if ($result < 0) $error++;
// End call triggers
}
if (!$error)
@ -441,7 +454,9 @@ class Opensurveysondage extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
$linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>';
@ -591,7 +606,7 @@ class Opensurveysondage extends CommonObject
$this->mail_admin = trim($this->mail_admin);
$this->nom_admin = trim($this->nom_admin);
$this->title = trim($this->title);
$this->status = trim($this->status);
$this->status = (int) $this->status;
$this->format = trim($this->format);
$this->mailsonde = ($this->mailsonde ? 1 : 0);
$this->allow_comments = ($this->allow_comments ? 1 : 0);

View File

@ -13,7 +13,7 @@
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2015-2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 David Beniamine <David.Beniamine@Tetras-Libre.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -1781,7 +1781,7 @@ if ($action == 'create' || $action == 'adduserldap')
$adh = new Adherent($db);
$adh->fetch($object->fk_member);
$adh->ref = $adh->getFullname($langs); // Force to show login instead of id
print $adh->getNomUrl(1);
print $adh->getNomUrl(-1);
} else {
print $langs->trans("UserNotLinkedToMember");
}

View File

@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
// Load translation files required by page
$langs->loadLangs(array('users', 'admin'));
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$action = (string) GETPOST('action', 'aZ09');
$id = (int) GETPOST('id', 'int');
// Security check
$socid = 0;
@ -54,14 +54,13 @@ if (empty($reshook)) {
$edituser = new User($db);
$edituser->fetch($id);
$edituser->clicktodial_url = GETPOST("url");
$edituser->clicktodial_login = GETPOST("login");
$edituser->clicktodial_password = GETPOST("password");
$edituser->clicktodial_poste = GETPOST("poste");
$edituser->clicktodial_url = (string) GETPOST("url", "alpha");
$edituser->clicktodial_login = (string) GETPOST("login", "alpha");
$edituser->clicktodial_password = (string) GETPOST("password", "alpha");
$edituser->clicktodial_poste = (string) GETPOST("poste", "alpha");
$result = $edituser->update_clicktodial();
if ($result < 0)
{
if ($result < 0) {
setEventMessages($edituser->error, $edituser->errors, 'errors');
}
}