diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3119e044be0..1856de6182f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -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; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 331d7e992ba..8cb1e85afe4 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -190,7 +190,7 @@ $head = ticketAdminPrepareHead(); dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket"); -print ''.$langs->trans("TicketSetupDictionaries") . ' : ' . dol_buildpath('/admin/dict.php', 2) . '
'; +print ''.$langs->trans("TicketSetupDictionaries") . ' : '.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'
'; dol_fiche_end(); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index dfefb8060fe..5c4df6ab3f9 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -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; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index d70a63293c5..5cec0232603 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -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) diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index b7d06870ff5..360b72f80d9 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -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."
\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; diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 9436bfa84e8..e16b6e87fd0 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -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) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index a5ce9e3ba68..21e9b56b4bb 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -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); diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 6a2d7e89cb7..70bd8220af0 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -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 diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index c648b15664e..1b3034bb82c 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -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)."'"; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 5b5b9ad48fa..26970f1dd13 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -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'); diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 05b992b3e40..a3e4d63a4bc 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -1,5 +1,6 @@ +/* Copyright (C) - 2013-2016 Jean-François FERRY + * Copyright (C) - 2019 Laurent Destailleur * * 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 '
' . $langs->trans('TicketPublicInterfaceForbidden') . '
'; -} else { - print '
'; - print '

' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '

'; - print ''; - print '
'; -} +print '
'; +print '

' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '

'; +print ''; +print '
'; // End of page htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 824b1f1833e..e7f7c6bff2f 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -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 '
'; @@ -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 .= '
'; print ''; print ''; -print ''; print '
' . $langs->trans("Statistics") . ' ' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"') . '
'; +print '
'; +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 '
'; @@ -303,7 +304,7 @@ if ($result) { print '
'; print ''; print ''; - print ''; + print ''; print ''; if ($num > 0) { @@ -359,7 +360,7 @@ if ($result) { $db->free(); } else { - print ''; + print ''; } print "
' . $transRecordedType . ''.$langs->trans("FullList").''.$langs->trans("FullList").'
' . $langs->trans('NoTicketsFound') . '
' . $langs->trans('NoUnreadTicketsFound') . '
"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 34651304b95..a151fdb5574 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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)) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index c3fe000292c..d51d82c8d13 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -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.= '
'; $label.= '' . $langs->trans("Group") . '
'; @@ -957,7 +956,7 @@ class UserGroup extends CommonObject public function _load_ldap_info() { // phpcs:enable - global $conf,$langs; + global $conf; $info=array();