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

Conflicts:
	htdocs/includes/odtphp/odf.php
This commit is contained in:
Laurent Destailleur 2019-06-19 13:18:01 +02:00
commit f32b2e9f1f
14 changed files with 87 additions and 76 deletions

View File

@ -183,14 +183,14 @@ class Adherent extends CommonObject
* @var integer
*/
public $datec;
/**
* Date modification record (tms)
*
* @var integer
*/
public $datem;
public $datevalid;
public $gender;
@ -1268,7 +1268,7 @@ class Adherent extends CommonObject
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
$this->civility_code = $obj->civility_code;
$this->civility = $obj->civility_code?($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code):'';
@ -2465,7 +2465,7 @@ class Adherent extends CommonObject
*
* @return array Tableau info des attributs
*/
private function _load_ldap_info()
public function _load_ldap_info()
{
// phpcs:enable
global $conf,$langs;

View File

@ -190,7 +190,7 @@ $head = ticketAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries") . '</span> : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries") . '</span> : <a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'</a><br>';
dol_fiche_end();

View File

@ -525,7 +525,7 @@ class Contact extends CommonObject
*
* @return array Tableau info des attributs
*/
private function _load_ldap_info()
public function _load_ldap_info()
{
// phpcs:enable
global $conf, $langs;

View File

@ -229,7 +229,7 @@ class DolGraph
/**
* Set width
*
* @param int $w Width
* @param int|string $w Width (Example: 320 or '100%')
* @return boolean|null True
*/
public function SetWidth($w)

View File

@ -403,9 +403,13 @@ class DoliDBSqlite3 extends DoliDB
*/
public function query($query, $usesavepoint = 0, $type = 'auto')
{
global $conf;
$ret=null;
$query = trim($query);
$this->error = 0;
$this->error = '';
// Convert MySQL syntax to SQLite syntax
if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+CONSTRAINT\s+(.*)\s*FOREIGN\s+KEY\s*\(([\w,\s]+)\)\s*REFERENCES\s+(\w+)\s*\(([\w,\s]+)\)/i', $query, $reg)) {
@ -449,7 +453,8 @@ class DoliDBSqlite3 extends DoliDB
}
//print "After convertSQLFromMysql:\n".$query."<br>\n";
dol_syslog('sql='.$query, LOG_DEBUG);
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG);
if (empty($query)) return false; // Return false = error if empty request
// Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
try {
@ -481,7 +486,8 @@ class DoliDBSqlite3 extends DoliDB
$errormsg .= ' ('.$this->lasterrno.')';
}
dol_syslog($errormsg, LOG_ERR);
if ($conf->global->SYSLOG_LEVEL < LOG_DEBUG) dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); // Log of request was not yet done previously
dol_syslog(get_class($this)."::query SQL Error message: ".$errormsg, LOG_ERR);
}
$this->lastquery=$query;
$this->_results = $ret;

View File

@ -99,6 +99,7 @@ class modTicket extends DolibarrModules
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->phpmin = array(5,4); // Minimum version of PHP required by module
$this->langfiles = array("ticket");
// Constants
// List of particular constants to add when module is enabled
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)

View File

@ -745,7 +745,7 @@ IMG;
private function _rrmdir($dir)
{
if ($handle = opendir($dir)) {
while (($file = readdir($handle))!==false) {
while (($file = readdir($handle)) !== false) {
if ($file != '.' && $file != '..') {
if (is_dir($dir . '/' . $file)) {
$this->_rrmdir($dir . '/' . $file);

View File

@ -133,6 +133,7 @@ TicketsIndex=Ticket - home
TicketList=List of tickets
TicketAssignedToMeInfos=This page display ticket list created by or assigned to current user
NoTicketsFound=No ticket found
NoUnreadTicketsFound=No unread ticket found
TicketViewAllTickets=View all tickets
TicketViewNonClosedOnly=View only open tickets
TicketStatByStatus=Tickets by status

View File

@ -249,8 +249,8 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
$dateinsertion = substr("$dateinsertion", 1);
//mise a jour avec les nouveaux sujets dans la base
if (isset($erreur_ajout_date) && !$erreur_ajout_date)
// update with new topics into database
if (isset($erreur_ajout_date) && empty($erreur_ajout_date))
{
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
$sql.= " SET sujet = '".$db->escape($dateinsertion)."'";

View File

@ -153,7 +153,7 @@ if (empty($reshook))
$db->begin();
$resql = $object->update($object->id, $user);
if (! $resql || $resql < 0)
if ($resql <= 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
/* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) - 2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -18,7 +19,7 @@
/**
* \file htdocs/public/ticket/index.php
* \ingroup ticket
* \brief Public file to add and manage ticket
* \brief Public page to add and manage ticket
*/
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
@ -56,21 +57,24 @@ $formticket = new FormTicket($db);
$arrayofjs = array();
$arrayofcss = array('/ticket/css/styles.css.php');
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
print $langs->trans('TicketPublicInterfaceForbidden');
exit;
}
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) {
print '<div class="error">' . $langs->trans('TicketPublicInterfaceForbidden') . '</div>';
} else {
print '<div style="margin: 0 auto; width:60%">';
print '<p style="text-align: center">' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '</p>';
print '<div class="ticketform">';
print '<a href="create_ticket.php" class=""><div class="index_create orange bigrounded">' . dol_escape_htmltag($langs->trans("CreateTicket")) . '</div></a>';
print '<a href="list.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowListTicketWithTrackId")) . '</div></a>';
print '<a href="view.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")) . '</div></a>';
print '<div style="clear:both;"></div>';
print '</div>';
print '</div>';
}
print '<div style="margin: 0 auto; width:60%">';
print '<p style="text-align: center">' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '</p>';
print '<div class="ticketform">';
print '<a href="create_ticket.php" class=""><div class="index_create orange bigrounded">' . dol_escape_htmltag($langs->trans("CreateTicket")) . '</div></a>';
print '<a href="list.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowListTicketWithTrackId")) . '</div></a>';
print '<a href="view.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")) . '</div></a>';
print '<div style="clear:both;"></div>';
print '</div>';
print '</div>';
// End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object);

View File

@ -24,6 +24,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/ticket/class/actions_ticket.class.php';
require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticketstats.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('companies', 'other', 'ticket'));
@ -102,8 +103,8 @@ if (empty($endyear)) {
}
$startyear = $endyear - 1;
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
$HEIGHT = '192';
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '100%' : '80%';
$HEIGHT = '228';
print '<div class="fichecenter"><div class="fichethirdleft">';
@ -120,16 +121,14 @@ $tick = array(
'closed' => 0,
'deleted' => 0,
);
$total = 0;
$sql = "SELECT t.fk_statut, COUNT(t.fk_statut) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')';
$sql .= " AND t.fk_statut IS NOT NULL";
$sql .= " AND date_format(datec,'%Y') = '" . $endyear . "'";
$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')';
$sql .= dolSqlDateFilter('datec', 0, 0, $endyear);
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
}
@ -149,44 +148,41 @@ $result = $db->query($sql);
if ($result) {
while ($objp = $db->fetch_object($result)) {
$found = 0;
if ($objp->fk_statut == 0) {
if ($objp->fk_statut == Ticket::STATUS_NOT_READ) {
$tick['unread'] = $objp->nb;
}
if ($objp->fk_statut == 1) {
if ($objp->fk_statut == Ticket::STATUS_READ) {
$tick['read'] = $objp->nb;
}
if ($objp->fk_statut == 3) {
$tick['answered'] = $objp->nb;
if ($objp->fk_statut == Ticket::STATUS_NEED_MORE_INFO) {
$tick['needmoreinfo'] = $objp->nb;
}
if ($objp->fk_statut == 4) {
if ($objp->fk_statut == Ticket::STATUS_ASSIGNED) {
$tick['assigned'] = $objp->nb;
}
if ($objp->fk_statut == 5) {
if ($objp->fk_statut == Ticket::STATUS_IN_PROGRESS) {
$tick['inprogress'] = $objp->nb;
}
if ($objp->fk_statut == 6) {
if ($objp->fk_statut == Ticket::STATUS_WAITING) {
$tick['waiting'] = $objp->nb;
}
if ($objp->fk_statut == 8) {
if ($objp->fk_statut == Ticket::STATUS_CLOSED) {
$tick['closed'] = $objp->nb;
}
if ($objp->fk_statut == 9) {
$tick['deleted'] = $objp->nb;
if ($objp->fk_statut == Ticket::STATUS_CANCELED) {
$tick['canceled'] = $objp->nb;
}
}
if ((round($tick['unread']) ? 1 : 0) +(round($tick['read']) ? 1 : 0) +(round($tick['answered']) ? 1 : 0) +(round($tick['assigned']) ? 1 : 0) +(round($tick['inprogress']) ? 1 : 0) +(round($tick['waiting']) ? 1 : 0) +(round($tick['closed']) ? 1 : 0) +(round($tick['deleted']) ? 1 : 0) >= 2
) {
$dataseries = array();
$dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
$dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
$dataseries[] = array('label' => $langs->trans("Answered"), 'data' => round($tick['answered']));
$dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
$dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress']));
$dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting']));
$dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed']));
$dataseries[] = array('label' => $langs->trans("Deleted"), 'data' => round($tick['deleted']));
}
$dataseries = array();
$dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
$dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
$dataseries[] = array('label' => $langs->trans("NeedMoreInformation"), 'data' => round($tick['needmoreinfo']));
$dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
$dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress']));
$dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting']));
$dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed']));
$dataseries[] = array('label' => $langs->trans("Canceled"), 'data' => round($tick['canceled']));
} else {
dol_print_error($db);
}
@ -210,11 +206,17 @@ $stringtoshow .= '</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th >' . $langs->trans("Statistics") . ' ' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"') . '</th></tr>';
print '<tr><td>';
print '<tr><td class="center">';
print $stringtoshow;
// don't display graph if no series
if (! empty($dataseries) && count($dataseries) > 1) {
$data = array();
$totalnb=0;
foreach ($dataseries as $key => $value) {
$totalnb += $value['data'];
}
$data = array();
foreach ($dataseries as $key => $value) {
$data[] = array($value['label'], $value['data']);
}
@ -244,10 +246,9 @@ if (! empty($dataseries) && count($dataseries) > 1) {
//$px1->SetTitle($langs->trans("TicketStatByStatus"));
$px1->draw($filenamenb, $fileurlnb);
print $px1->show();
print $px1->show($totalnb?0:1);
}
}
print $stringtoshow;
print '</td></tr>';
print '</table>';
@ -303,7 +304,7 @@ if ($result) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="5">' . $transRecordedType . '</th>';
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/ticket/list.php">'.$langs->trans("FullList").'</th>';
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/ticket/list.php?search_fk_statut[]='.Ticket::STATUS_NOT_READ.'">'.$langs->trans("FullList").'</th>';
print '</tr>';
if ($num > 0) {
@ -359,7 +360,7 @@ if ($result) {
$db->free();
} else {
print '<tr><td colspan="6" class="opacitymedium">' . $langs->trans('NoTicketsFound') . '</td></tr>';
print '<tr><td colspan="6" class="opacitymedium">' . $langs->trans('NoUnreadTicketsFound') . '</td></tr>';
}
print "</table>";

View File

@ -774,7 +774,7 @@ class User extends CommonObject
dol_syslog(get_class($this)."::clearrights reset user->rights");
$this->rights='';
$this->nb_rights=0;
$this->all_permissions_are_loaded=false;
$this->all_permissions_are_loaded=0;
$this->_tab_loaded=array();
}
@ -799,16 +799,16 @@ class User extends CommonObject
return;
}
if ($this->all_permissions_are_loaded)
if (! empty($this->all_permissions_are_loaded))
{
// We already loaded all rights for this user, so we leave
return;
}
}
// Recuperation des droits utilisateurs + recuperation des droits groupes
// Get permission of users + Get permissions of groups
// D'abord les droits utilisateurs
// First user permissions
$sql = "SELECT DISTINCT r.module, r.perms, r.subperms";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as r";
@ -862,7 +862,7 @@ class User extends CommonObject
$this->db->free($resql);
}
// Maintenant les droits groupes
// Now permissions of groups
$sql = "SELECT DISTINCT r.module, r.perms, r.subperms";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,";
@ -933,7 +933,7 @@ class User extends CommonObject
}
else
{
// Si module defini, on le marque comme charge en cache
// If module defined, we flag it as loaded into cache
$this->_tab_loaded[$moduletag]=1;
}
}
@ -2300,7 +2300,6 @@ class User extends CommonObject
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
$result=''; $label='';
$link=''; $linkstart=''; $linkend='';
if (! empty($this->photo))
{

View File

@ -552,13 +552,13 @@ class UserGroup extends CommonObject
if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag])
{
// Le fichier de ce module est deja charge
// Rights for this module are already loaded, so we leave
return;
}
if (! empty($this->all_permissions_are_loaded))
{
// Si les permissions ont deja ete chargees, on quitte
// We already loaded all rights for this group, so we leave
return;
}
@ -618,7 +618,7 @@ class UserGroup extends CommonObject
}
else
{
// Si module defini, on le marque comme charge en cache
// If module defined, we flag it as loaded into cache
$this->_tab_loaded[$moduletag]=1;
}
@ -867,7 +867,6 @@ class UserGroup extends CommonObject
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto=0;
$result=''; $label='';
$link=''; $linkstart=''; $linkend='';
$label.= '<div class="centpercent">';
$label.= '<u>' . $langs->trans("Group") . '</u><br>';
@ -957,7 +956,7 @@ class UserGroup extends CommonObject
public function _load_ldap_info()
{
// phpcs:enable
global $conf,$langs;
global $conf;
$info=array();