Skip to content

Commit

Permalink
Merge branch 'develop' into ticketsup_core
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 11, 2018
2 parents 3b814eb + d0598a7 commit 40cf236
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 54 deletions.
8 changes: 4 additions & 4 deletions htdocs/core/modules/DolibarrModules.class.php
Expand Up @@ -1049,7 +1049,7 @@ function _load_tables($reldir)
{
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++;
}
}
Expand All @@ -1067,7 +1067,7 @@ function _load_tables($reldir)
{
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++;
}
}
Expand All @@ -1085,7 +1085,7 @@ function _load_tables($reldir)
{
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++;
}
}
Expand All @@ -1103,7 +1103,7 @@ function _load_tables($reldir)
{
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++;
}
}
Expand Down
102 changes: 53 additions & 49 deletions htdocs/ticketsup/class/ticketsup.class.php
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -1003,7 +1003,7 @@ public function initAsSpecimen()
$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 = '');
Expand Down Expand Up @@ -1106,7 +1106,7 @@ public function loadCacheSeveritiesTickets()
$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);
Expand All @@ -1132,9 +1132,9 @@ public function loadCacheSeveritiesTickets()

/**
* 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)
{
Expand All @@ -1143,13 +1143,13 @@ public function getLibStatut($mode = 0)


/**
* 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;

Expand Down Expand Up @@ -1294,10 +1294,11 @@ public function libStatut($statut, $mode = 0)
}

/**
* 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 = '')
{
Expand Down Expand Up @@ -1328,21 +1329,21 @@ public function getNomUrl($withpicto = 0, $option = '')

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)
{
global $conf, $langs;

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;
Expand Down Expand Up @@ -1379,12 +1380,12 @@ public function markAsRead($user, $notrigger = 0)
}

/**
* 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)
{
Expand Down Expand Up @@ -1488,11 +1489,11 @@ public function createTicketLog(User $user, $message, $noemail = 0)
}

/**
* 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)
{
Expand Down Expand Up @@ -1735,7 +1736,7 @@ public function loadCacheMsgsTicket()

/**
* Close a ticket
*
*
* @return int <0 if KO, >0 if OK
*/
public function close()
Expand Down Expand Up @@ -2101,6 +2102,7 @@ public function getTicketAllContacts()
/**
* Return id of all contacts for ticket
*
* @return array Array of contacts
*/
public function getTicketAllCustomerContacts()
{
Expand All @@ -2114,9 +2116,10 @@ public function getTicketAllCustomerContacts()

/**
* 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)
{
Expand All @@ -2138,7 +2141,8 @@ public function messageSend($subject, $texte)
$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');

Expand Down Expand Up @@ -2239,12 +2243,12 @@ public function messageSend($subject, $texte)
* 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;

Expand Down Expand Up @@ -2453,10 +2457,10 @@ public function ticketsupBannerTab($paramid, $morehtml = '', $shownav = 1, $fiel
}

/**
* 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)
{
Expand Down
1 change: 1 addition & 0 deletions htdocs/ticketsup/tpl/index.html
@@ -0,0 +1 @@

8 changes: 7 additions & 1 deletion htdocs/ticketsup/tpl/linkedobjectblock.tpl.php
Expand Up @@ -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;
}
?>

<!-- BEGIN PHP TEMPLATE -->
Expand Down Expand Up @@ -55,4 +61,4 @@
<?php } ?>
</table>

<!-- END PHP TEMPLATE -->
<!-- END PHP TEMPLATE -->

0 comments on commit 40cf236

Please sign in to comment.