diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index eaf674d5eea..160499d3a45 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1049,7 +1049,7 @@ class DolibarrModules // Can not be abstract, because we need to insta { if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); if ($result <= 0) $error++; } } @@ -1067,7 +1067,7 @@ class DolibarrModules // Can not be abstract, because we need to insta { if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); if ($result <= 0) $error++; } } @@ -1085,7 +1085,7 @@ class DolibarrModules // Can not be abstract, because we need to insta { if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); if ($result <= 0) $error++; } } @@ -1103,7 +1103,7 @@ class DolibarrModules // Can not be abstract, because we need to insta { if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update') { - $result=run_sql($dir.$file,1,'',1); + $result=run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG)?0:1, '', 1); if ($result <= 0) $error++; } } diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php index 2c18a8ced46..33bd82c38e6 100644 --- a/htdocs/ticketsup/class/ticketsup.class.php +++ b/htdocs/ticketsup/class/ticketsup.class.php @@ -54,8 +54,8 @@ class Ticketsup extends CommonObject * @var string String with name of icon for ticketsupcore. Must be the part after the 'object_' into object_ticketsupcore.png */ public $picto = 'ticketsup@ticketsup'; - - + + /** * @var string Hash to identify ticket */ @@ -192,9 +192,9 @@ class Ticketsup extends CommonObject 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1) - + ); - + /** * Constructor * @@ -1003,7 +1003,7 @@ class Ticketsup extends CommonObject $this->tms = ''; } - + public function printSelectStatus($selected = "") { print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); @@ -1106,7 +1106,7 @@ class Ticketsup extends CommonObject $sql .= " FROM " . MAIN_DB_PREFIX . "c_ticketsup_severity"; $sql .= " WHERE active > 0"; $sql .= " ORDER BY pos"; - dol_syslog(get_class($this) . "::load_cache_severities_tickets sql=" . $sql, LOG_DEBUG); + dol_syslog(get_class($this) . "::loadCacheSeveritiesTickets sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -1132,9 +1132,9 @@ class Ticketsup extends CommonObject /** * Return status label of object - * - * @param number $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label */ public function getLibStatut($mode = 0) { @@ -1143,13 +1143,13 @@ class Ticketsup extends CommonObject /** - * Return status label of object - * - * @param int $statut id statut - * @param number $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string + * Return status label of object + * + * @param string $statut id statut + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label */ - public function libStatut($statut, $mode = 0) + function LibStatut($statut, $mode = 0) { global $langs; @@ -1294,10 +1294,11 @@ class Ticketsup extends CommonObject } /** - * Return clckable link to object - * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * @param string $option Where to point the link - * @return string + * Return clickable link to object + * + * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * @param string $option Sur quoi pointe le lien + * @return string Chaine avec URL */ public function getNomUrl($withpicto = 0, $option = '') { @@ -1328,13 +1329,13 @@ class Ticketsup extends CommonObject return $result; } - + /** - * Mark a message as read - * - * @param User $user User for action - * @param int $notrigger Lauch trigger or not - * @return int 1 if ok, -1 otherwise + * Mark a message as read + * + * @param User $user Object user + * @param int $notrigger No trigger + * @return int <0 if KO, >0 if OK */ public function markAsRead($user, $notrigger = 0) { @@ -1342,7 +1343,7 @@ class Ticketsup extends CommonObject if ($this->statut != 9) { // no closed $this->db->begin(); - + $sql = "UPDATE " . MAIN_DB_PREFIX . "ticketsup"; $sql .= " SET fk_statut = 1, date_read='" . $this->db->idate(dol_now()) . "'"; $sql .= " WHERE rowid = " . $this->id; @@ -1379,12 +1380,12 @@ class Ticketsup extends CommonObject } /** - * Assign ticket to an user - * - * @param User $user User for action - * @param int $id_assign_user IP user assigned - * @param int $notrigger Disable trigger if 1 - * @return number + * Mark a message as read + * + * @param User $user Object user + * @param int $id_assign_user ID of user assigned + * @param int $notrigger Disable trigger + * @return int <0 if KO, >0 if OK */ public function assignUser($user, $id_assign_user, $notrigger = 0) { @@ -1488,11 +1489,11 @@ class Ticketsup extends CommonObject } /** - * Send notification of changes by email + * Send notification of changes by email * - * @param User $user User that create - * @param string $message Log message - * @return int <0 if KO, >0 if OK (number of emails sent) + * @param User $user User that create + * @param string $log_message Log message + * @return int <0 if KO, >0 if OK (number of emails sent) */ private function sendLogByEmail($user, $message) { @@ -1735,7 +1736,7 @@ class Ticketsup extends CommonObject /** * Close a ticket - * + * * @return int <0 if KO, >0 if OK */ public function close() @@ -2101,6 +2102,7 @@ class Ticketsup extends CommonObject /** * Return id of all contacts for ticket * + * @return array Array of contacts */ public function getTicketAllCustomerContacts() { @@ -2114,9 +2116,10 @@ class Ticketsup extends CommonObject /** * Send message - * @param string $subject Subject for message - * @param string $texte Text for message - * @return int 1 if ok, -1 otherwise + * + * @param string $subject Subject + * @param string $texte Message to send + * @return int <0 if KO, or number of changes if OK */ public function messageSend($subject, $texte) { @@ -2138,7 +2141,8 @@ class Ticketsup extends CommonObject $sendto = $obj->firstname . " " . $obj->lastname . " <" . $obj->email . ">"; $actiondefid = $obj->adid; - if (dol_strlen($sendto)) { + if (dol_strlen($sendto)) + { include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM'); @@ -2239,12 +2243,12 @@ class Ticketsup extends CommonObject * Get array of all contacts for a ticket * Override method of file commonobject.class.php to add phone number * - * @param int $statut Status of lines to get (-1=all) - * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) - * @param int $list 0:Return array contains all properties, 1:Return array contains just id - * @return array Array of contacts + * @param int $statut Status of lines to get (-1=all) + * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) + * @param int $list 0:Return array contains all properties, 1:Return array contains just id + * @return array Array of contacts */ - public function listeContact($statut = -1, $source = 'external', $list = 0) + function liste_contact($statut = -1, $source = 'external', $list = 0) { global $langs; @@ -2453,10 +2457,10 @@ class Ticketsup extends CommonObject } /** - * Affiche la premiere photo du ticket + * Return if at least one photo is available * - * @param string $sdir Repertoire a scanner - * @return boolean true si photo dispo, false sinon + * @param string $sdir Directory to scan + * @return boolean True if at least one photo is available, False if not */ function is_photo_available($sdir) { diff --git a/htdocs/ticketsup/tpl/index.html b/htdocs/ticketsup/tpl/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/ticketsup/tpl/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php b/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php index cd23471129e..4c1a00c3d82 100644 --- a/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php +++ b/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php @@ -16,6 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +// Protection to avoid direct call of template +if (empty($conf) || ! is_object($conf)) +{ + print "Error, template page can't be called as URL"; + exit; +} ?> @@ -55,4 +61,4 @@ foreach ($linkedObjectBlock as $object) { - \ No newline at end of file +