Dolibarize

This commit is contained in:
Laurent Destailleur 2018-03-11 11:12:38 +01:00
parent 8217587b5e
commit e14d2f08b8
10 changed files with 93 additions and 109 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) - 2013-2015 Jean-François FERRY <hello@librethic.io> /* Copyright (C) - 2013-2015 Jean-François FERRY <hello@librethic.io>
* 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -31,8 +31,8 @@ if (!class_exists('FormCompany')) {
/** /**
* Classe permettant la generation du formulaire d'un nouveau ticket * Classe permettant la generation du formulaire d'un nouveau ticket
* *
* @package ticketsup * \ingroup ticketsup
*
* \remarks Utilisation: $formticketsup = new FormTicketsup($db) * \remarks Utilisation: $formticketsup = new FormTicketsup($db)
* \remarks $formticketsup->proprietes=1 ou chaine ou tableau de valeurs * \remarks $formticketsup->proprietes=1 ou chaine ou tableau de valeurs
* \remarks $formticketsup->show_form() affiche le formulaire * \remarks $formticketsup->show_form() affiche le formulaire
@ -74,7 +74,6 @@ class FormTicketsup
public $withcancel; public $withcancel;
/** /**
*
* @var array $substit Substitutions * @var array $substit Substitutions
*/ */
public $substit = array(); public $substit = array();
@ -432,7 +431,7 @@ class FormTicketsup
$filterarray = explode(',', $filtertype); $filterarray = explode(',', $filtertype);
} }
$ticketstat->load_cache_types_tickets(); $ticketstat->loadCacheTypesTickets();
print '<select id="select' . $htmlname . '" class="flat select_tickettype" name="' . $htmlname . '">'; print '<select id="select' . $htmlname . '" class="flat select_tickettype" name="' . $htmlname . '">';
if ($empty) { if ($empty) {

View File

@ -18,12 +18,10 @@
*/ */
/** /**
* \file lib/ticketsup.lib.php * \file core/lib/ticketsup.lib.php
* \ingroup ticketsup * \ingroup ticketsup
* \brief This file is an example module library * \brief This file is an example module library
* Put some comments here
*/ */
function ticketsupAdminPrepareHead() function ticketsupAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf;
@ -60,16 +58,15 @@ function ticketsupAdminPrepareHead()
} }
/** /**
* \file htdocs/hosting/lib/hosting.lib.php * Prepare head for ticket card
* \brief Ensemble de fonctions de base pour le module hosting *
* \ingroup business * @param Object $object Object Ticket
* \version $Id$ * @return array Array of tabs
*/ */
function ticketsup_prepare_head($object) function ticketsup_prepare_head($object)
{ {
global $db, $langs, $conf, $user; global $db, $langs, $conf, $user;
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = dol_buildpath('/ticketsup/card.php', 1) . '?action=view&track_id=' . $object->track_id; $head[$h][0] = dol_buildpath('/ticketsup/card.php', 1) . '?action=view&track_id=' . $object->track_id;

View File

@ -139,15 +139,4 @@ class mod_ticketsup_simple extends ModeleNumRefTicketsup
return $this->prefix . $yymm . "-" . $num; return $this->prefix . $yymm . "-" . $num;
} }
/**
* Return next reference not yet used as a reference
*
* @param Societe $objsoc Object third party
* @param Project $ticketsup Object ticketsup
* @return string Next not used reference
*/
public function ticketsup_get_num($objsoc = 0, $ticketsup = '')
{
return $this->getNextValue($objsoc, $ticketsup);
}
} }

View File

@ -122,15 +122,4 @@ class mod_ticketsup_universal extends ModeleNumRefTicketsup
return $numFinal; return $numFinal;
} }
/**
* Return next reference not yet used as a reference
*
* @param Societe $objsoc Object third party
* @param Project $ticketsup Object ticketsup
* @return string Next not used reference
*/
public function ticketsup_get_num($objsoc = 0, $ticketsup = '')
{
return $this->getNextValue($objsoc, $ticketsup);
}
} }

View File

@ -29,9 +29,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
/** /**
* \class ActionsTicketsup * Class Actions of the module ticketsup
* \brief Class Actions of the module ticketsup
*/ */
class ActionsTicketsup class ActionsTicketsup
{ {
@ -76,9 +76,10 @@ class ActionsTicketsup
} }
/** /**
* Enter description here ... * doActions
* *
* @param string $action Action type * @param string $action Action type
* @return int 0
*/ */
public function doActions(&$action = '') public function doActions(&$action = '')
{ {
@ -601,17 +602,18 @@ class ActionsTicketsup
} }
} }
} }
return 0;
} }
/** /**
* Add new message on a ticket (private area) * Add new message on a ticket (private area)
* *
* @param unknown $user * @param User $user Object user
* @param unknown $action * @param string $action Action
*/ */
private function newMessage($user, &$action) private function newMessage($user, &$action)
{ {
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
if (!class_exists('Contact')) { if (!class_exists('Contact')) {
@ -818,8 +820,8 @@ class ActionsTicketsup
/** /**
* Add new message on a ticket (public area) * Add new message on a ticket (public area)
* *
* @param unknown $user * @param User $user Object user
* @param unknown $action * @param string $action Action
*/ */
private function newMessagePublic($user, &$action) private function newMessagePublic($user, &$action)
{ {
@ -962,9 +964,12 @@ class ActionsTicketsup
/** /**
* Fetch object * Fetch object
* *
* @param int $id Id
* @param int $track_id Track id
* @param string $ref Ref
* @return void * @return void
*/ */
public function fetch($id = '', $track_id = '', $ref = '') public function fetch($id = 0, $track_id = 0, $ref = '')
{ {
$this->getInstanceDao(); $this->getInstanceDao();
return $this->dao->fetch($id, $track_id, $ref); return $this->dao->fetch($id, $track_id, $ref);
@ -973,6 +978,7 @@ class ActionsTicketsup
/** /**
* print statut * print statut
* *
* @param int $mode Mode
* @return void * @return void
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
@ -985,7 +991,8 @@ class ActionsTicketsup
/** /**
* Get ticket info * Get ticket info
* *
* @param id Object id * @param int $id Object id
* @return void
*/ */
public function getInfo($id) public function getInfo($id)
{ {
@ -999,7 +1006,8 @@ class ActionsTicketsup
/** /**
* Get action title * Get action title
* *
* @param action Type of action * @param string $action Type of action
* @return string Label
*/ */
public function getTitle($action = '') public function getTitle($action = '')
{ {
@ -1022,6 +1030,7 @@ class ActionsTicketsup
* View html list of logs * View html list of logs
* *
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTicketLogs($show_user = true) public function viewTicketLogs($show_user = true)
{ {
@ -1084,6 +1093,7 @@ class ActionsTicketsup
* View list of logs with timeline view * View list of logs with timeline view
* *
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTimelineTicketLogs($show_user = true) public function viewTimelineTicketLogs($show_user = true)
{ {
@ -1129,8 +1139,9 @@ class ActionsTicketsup
/** /**
* Show ticket original message * Show ticket original message
* *
* @param User $user $user wich display * @param User $user Object user
* @param string $action * @param string $action Action
* @return void
*/ */
public function viewTicketOriginalMessage($user, $action = '') public function viewTicketOriginalMessage($user, $action = '')
{ {
@ -1187,6 +1198,7 @@ class ActionsTicketsup
* *
* @param boolean $show_private Show private messages * @param boolean $show_private Show private messages
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTicketMessages($show_private, $show_user = true) public function viewTicketMessages($show_private, $show_user = true)
{ {
@ -1258,6 +1270,7 @@ class ActionsTicketsup
* *
* @param boolean $show_private Show private messages * @param boolean $show_private Show private messages
* @param boolean $show_user Show user who make action * @param boolean $show_user Show user who make action
* @return void
*/ */
public function viewTicketTimelineMessages($show_private, $show_user = true) public function viewTicketTimelineMessages($show_private, $show_user = true)
{ {
@ -1309,6 +1322,13 @@ class ActionsTicketsup
} }
} }
/**
* load_previous_next_ref
*
* @param string $filter Filter
* @param int $fieldid Id
* @return int 0
*/
public function load_previous_next_ref($filter, $fieldid) public function load_previous_next_ref($filter, $fieldid)
{ {
$this->getInstanceDao(); $this->getInstanceDao();
@ -1399,12 +1419,12 @@ class ActionsTicketsup
/** /**
* Copy files into ticket directory * Copy files into ticket directory
*
* Used for files linked into messages * Used for files linked into messages
*
* @return void
*/ */
public function copyFilesForTicket() public function copyFilesForTicket()
{ {
global $conf; global $conf;
// Create form object // Create form object
@ -1446,9 +1466,9 @@ class ActionsTicketsup
/** /**
* Print html navbar with link to set ticket status * Print html navbar with link to set ticket status
* $selected : 0=>'NotRead', 1=>'Read', 3=>'Answered', 4=>'Assigned', 5 => 'InProgress', 6=> 'Waiting', 8=>'Closed', 9=>'Deleted'
* *
* @global type $langs * @return void
* @param type $selected : 0=>'NotRead', 1=>'Read', 3=>'Answered', 4=>'Assigned', 5 => 'InProgress', 6=> 'Waiting', 8=>'Closed', 9=>'Deleted'
*/ */
public function viewStatusActions() public function viewStatusActions()
{ {
@ -1487,7 +1507,11 @@ class ActionsTicketsup
} }
/**
* deleteObjectLinked
*
* @return number
*/
public function deleteObjectLinked() public function deleteObjectLinked()
{ {
return $this->dao->deleteObjectLinked(); return $this->dao->deleteObjectLinked();
@ -1496,10 +1520,10 @@ class ActionsTicketsup
/** /**
* Hook to add email element template * Hook to add email element template
* *
* @param array $parameters * @param array $parameters Parameters
* @param Object $object * @param Object $object Object
* @param string $action * @param string $action Action
* @param HookManager $hookmanager * @param HookManager $hookmanager Hookmanager
* @return int * @return int
*/ */
public function emailElementlist($parameters, &$object, &$action, $hookmanager) public function emailElementlist($parameters, &$object, &$action, $hookmanager)

View File

@ -472,7 +472,7 @@ class Ticketsups extends DolibarrApi
* @todo use an array for properties to clean * @todo use an array for properties to clean
* *
*/ */
public function _cleanObjectDatas($object) function _cleanObjectDatas($object)
{ {
// Remove $db object property for object // Remove $db object property for object

View File

@ -536,10 +536,9 @@ class Ticketsup extends CommonObject
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit page number * @param int $limit page number
* @param int $offset * @param int $offset Offset
* @param int $arch archive or not (not used) * @param int $arch archive or not (not used)
* @param array $filter * @param array $filter Filter
* output
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '') public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '')
@ -1012,7 +1011,7 @@ class Ticketsup extends CommonObject
* *
* @return int Nb lignes chargees, 0 si deja chargees, <0 si ko * @return int Nb lignes chargees, 0 si deja chargees, <0 si ko
*/ */
public function load_cache_types_tickets() public function loadCacheTypesTickets()
{ {
global $langs; global $langs;

View File

@ -69,8 +69,7 @@ class Diff
$table = self::computeTable($sequence1, $sequence2, $start, $end1, $end2); $table = self::computeTable($sequence1, $sequence2, $start, $end1, $end2);
// generate the partial diff // generate the partial diff
$partialDiff = $partialDiff = self::generatePartialDiff($table, $sequence1, $sequence2, $start);
self::generatePartialDiff($table, $sequence1, $sequence2, $start);
// generate the full diff // generate the full diff
$diff = array(); $diff = array();
@ -148,8 +147,7 @@ class Diff
) { ) {
$table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1; $table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1;
} else { } else {
$table[$index1][$index2] = $table[$index1][$index2] = max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]);
max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]);
} }
} }
} }
@ -306,8 +304,7 @@ class Diff
switch ($diff[$index][1]) { switch ($diff[$index][1]) {
// display the content on the left and right // display the content on the left and right
case self::UNMODIFIED: case self::UNMODIFIED:
$leftCell = $leftCell = self::getCellContent(
self::getCellContent(
$diff, $diff,
$indentation, $indentation,
$separator, $separator,
@ -319,16 +316,14 @@ class Diff
// display the deleted on the left and inserted content on the right // display the deleted on the left and inserted content on the right
case self::DELETED: case self::DELETED:
$leftCell = $leftCell = self::getCellContent(
self::getCellContent(
$diff, $diff,
$indentation, $indentation,
$separator, $separator,
$index, $index,
self::DELETED self::DELETED
); );
$rightCell = $rightCell = self::getCellContent(
self::getCellContent(
$diff, $diff,
$indentation, $indentation,
$separator, $separator,
@ -340,8 +335,7 @@ class Diff
// display the inserted content on the right // display the inserted content on the right
case self::INSERTED: case self::INSERTED:
$leftCell = ''; $leftCell = '';
$rightCell = $rightCell = self::getCellContent(
self::getCellContent(
$diff, $diff,
$indentation, $indentation,
$separator, $separator,
@ -388,14 +382,8 @@ class Diff
* $index - the current index, passes by reference * $index - the current index, passes by reference
* $type - the type of line * $type - the type of line
*/ */
private static function getCellContent( private static function getCellContent($diff, $indentation, $separator, &$index, $type)
$diff, {
$indentation,
$separator,
&$index,
$type
) {
// initialise the HTML // initialise the HTML
$html = ''; $html = '';

View File

@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/ */
?> ?>