Debug module ticket

This commit is contained in:
Laurent Destailleur 2019-05-01 20:55:46 +02:00
parent 90a1181dc5
commit 3a8d645fb9
6 changed files with 13 additions and 61 deletions

View File

@ -94,6 +94,9 @@ ALTER TABLE llx_bank_url DROP INDEX uk_bank_url;
ALTER TABLE llx_bank_url ADD UNIQUE INDEX uk_bank_url (fk_bank, url_id, type);
ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer;
ALTER TABLE llx_actioncomm ADD COLUMN visibility varchar(12) DEFAULT 'default';
DROP TABLE llx_ticket_msg;
ALTER TABLE llx_don ADD COLUMN fk_soc integer NULL;

View File

@ -46,7 +46,8 @@ create table llx_actioncomm
transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources.
priority smallint, -- priority (ical standard)
fulldayevent smallint NOT NULL default 0, -- priority (ical standard)
visibility varchar(12) DEFAULT 'default', -- visibility (ical standard) - 'default', 'public', 'private', 'confidential'
fulldayevent smallint NOT NULL default 0, -- full day (ical standard)
punctual smallint NOT NULL default 1, -- deprecated. milestone is event with date start (datep) = date end (datep2)
percent smallint NOT NULL default 0,
location varchar(128),

View File

@ -1,17 +0,0 @@
-- SQL definition for module ticket
-- Copyright (C) 2013 Jean-François FERRY <hello@librethic.io>
--
-- 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--ALTER TABLE llx_ticket_msg ADD CONSTRAINT fk_ticket_msg_fk_track_id FOREIGN KEY (fk_track_id) REFERENCES llx_ticket (track_id);

View File

@ -1,26 +0,0 @@
-- SQL definition for module ticket
-- Copyright (C) 2013 Jean-François FERRY <hello@librethic.io>
--
-- 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
CREATE TABLE llx_ticket_msg
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
fk_track_id varchar(128),
fk_user_action integer,
datec datetime,
message text,
private integer DEFAULT 0
)ENGINE=innodb;

View File

@ -123,19 +123,14 @@ class Tickets extends DolibarrApi
/**
* Get properties of a Ticket object
*
* Return an array with ticket informations
*
* @param int $id ID of ticket
* @param string $track_id Tracking ID of ticket
* @param string $ref Reference for ticket
* @return array|mixed Data without useless information
*
* @throws 401
* @throws 403
* @throws 404
*/
public function getCommon($id = 0, $track_id = '', $ref = '')
private function getCommon($id = 0, $track_id = '', $ref = '')
{
if (! DolibarrApiAccess::$user->rights->ticket->read) {
throw new RestException(403);

View File

@ -906,12 +906,6 @@ class Ticket extends CommonObject
if ($res < 0) $error++;
}
if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "ticket_msg";
$sql .= " WHERE fk_track_id = '" . $this->db->escape($this->track_id) . "'";
$resql = $this->db->query($sql);
}
// Removed extrafields
if (!$error) {
$result = $this->deleteExtraFields();
@ -1677,12 +1671,13 @@ class Ticket extends CommonObject
}
// Cache deja charge
$sql = "SELECT rowid, fk_user_action, datec, message, private";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket_msg";
$sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'";
$sql = "SELECT rowid, fk_user_author, datec, label, message, visibility";
$sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm";
$sql .= " WHERE fk_element = " . (int) $this->id;
$sql .= " AND elementtype = 'ticket'";
$sql .= " ORDER BY datec DESC";
dol_syslog(get_class($this) . "::load_cache_actions_ticket sql=" . $sql, LOG_DEBUG);
dol_syslog(get_class($this) . "::load_cache_actions_ticket sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@ -1692,8 +1687,9 @@ class Ticket extends CommonObject
$this->cache_msgs_ticket[$i]['id'] = $obj->rowid;
$this->cache_msgs_ticket[$i]['fk_user_action'] = $obj->fk_user_action;
$this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
$this->cache_msgs_ticket[$i]['subject'] = $obj->label;
$this->cache_msgs_ticket[$i]['message'] = $obj->message;
$this->cache_msgs_ticket[$i]['private'] = $obj->private;
$this->cache_msgs_ticket[$i]['private'] = ($obj->visibility == 'private' ? 1 : 0);
$i++;
}
return $num;