2014-01-02 07:07:43 +01:00
< ? php
2016-01-21 11:18:29 +01:00
/* Copyright ( C ) 2013 - 2015 Jean - François Ferry < jfefe @ aternatik . fr >
2014-01-02 07:07:43 +01:00
*
* 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
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2014-01-02 07:07:43 +01:00
*/
/**
2014-03-15 07:31:49 +01:00
* \file resource / class / resource . class . php
* \ingroup resource
2014-01-02 07:07:43 +01:00
* \brief Class file for resource object
*/
2014-10-30 01:33:39 +01:00
require_once DOL_DOCUMENT_ROOT . " /core/class/commonobject.class.php " ;
require_once DOL_DOCUMENT_ROOT . " /core/lib/functions2.lib.php " ;
2014-01-02 07:07:43 +01:00
/**
2018-08-15 17:34:35 +02:00
* DAO Resource object
2014-01-02 07:07:43 +01:00
*/
2016-01-21 11:18:29 +01:00
class Dolresource extends CommonObject
2014-01-02 07:07:43 +01:00
{
2018-08-23 18:52:47 +02:00
/**
* @ var string ID to identify managed object
*/
2018-08-29 15:37:35 +02:00
public $element = 'dolresource' ;
2018-08-22 19:56:24 +02:00
/**
* @ var string Name of table without prefix where object is stored
*/
2018-08-29 15:37:35 +02:00
public $table_element = 'resource' ;
2019-10-30 10:09:37 +01:00
/**
* @ var string String with name of icon for myobject . Must be the part after the 'object_' into object_myobject . png
*/
public $picto = 'resource' ;
2017-09-15 15:41:07 +02:00
2017-05-23 13:38:48 +02:00
public $resource_id ;
public $resource_type ;
public $element_id ;
public $element_type ;
public $busy ;
public $mandatory ;
2018-10-12 09:34:54 +02:00
/**
* @ var int ID
*/
2017-05-23 13:38:48 +02:00
public $fk_user_create ;
2018-10-12 09:34:54 +02:00
2017-05-23 13:38:48 +02:00
public $type_label ;
public $tms = '' ;
2014-01-02 07:07:43 +01:00
2019-01-21 10:12:13 +01:00
public $cache_code_type_resource = array ();
public $oldcopy ;
2017-08-30 11:26:48 +02:00
2014-01-02 07:07:43 +01:00
/**
* Constructor
*
* @ param DoliDb $db Database handler
*/
2019-02-28 22:44:12 +01:00
public function __construct ( $db )
2014-01-02 07:07:43 +01:00
{
$this -> db = $db ;
}
2014-03-15 22:31:11 +01:00
/**
* Create object into database
*
2018-08-15 17:34:35 +02:00
* @ param User $user User that creates
2014-03-15 22:31:11 +01:00
* @ param int $notrigger 0 = launch triggers after , 1 = disable triggers
* @ return int < 0 if KO , Id of created object if OK
*/
2019-02-28 22:44:12 +01:00
public function create ( $user , $notrigger = 0 )
2014-03-15 22:31:11 +01:00
{
2018-08-15 17:34:35 +02:00
global $conf , $langs , $hookmanager ;
$error = 0 ;
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
// Clean parameters
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
if ( isset ( $this -> ref )) $this -> ref = trim ( $this -> ref );
if ( isset ( $this -> description )) $this -> description = trim ( $this -> description );
2017-11-21 23:11:33 +01:00
if ( ! is_numeric ( $this -> country_id )) $this -> country_id = 0 ;
2014-03-15 22:31:11 +01:00
if ( isset ( $this -> fk_code_type_resource )) $this -> fk_code_type_resource = trim ( $this -> fk_code_type_resource );
if ( isset ( $this -> note_public )) $this -> note_public = trim ( $this -> note_public );
if ( isset ( $this -> note_private )) $this -> note_private = trim ( $this -> note_private );
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
// Insert request
2015-08-12 21:48:00 +02:00
$sql = " INSERT INTO " . MAIN_DB_PREFIX . $this -> table_element . " ( " ;
2014-04-23 19:04:10 +02:00
2015-11-22 12:23:10 +01:00
$sql .= " entity, " ;
2014-03-15 22:31:11 +01:00
$sql .= " ref, " ;
$sql .= " description, " ;
2017-11-21 23:11:33 +01:00
$sql .= " fk_country, " ;
2014-03-15 22:31:11 +01:00
$sql .= " fk_code_type_resource, " ;
$sql .= " note_public, " ;
$sql .= " note_private " ;
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
$sql .= " ) VALUES ( " ;
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
$sql .= $conf -> entity . " , " ;
$sql .= " " . ( ! isset ( $this -> ref ) ? 'NULL' : " ' " . $this -> db -> escape ( $this -> ref ) . " ' " ) . " , " ;
$sql .= " " . ( ! isset ( $this -> description ) ? 'NULL' : " ' " . $this -> db -> escape ( $this -> description ) . " ' " ) . " , " ;
2017-11-21 23:11:33 +01:00
$sql .= " " . ( $this -> country_id > 0 ? $this -> country_id : 'null' ) . " , " ;
2014-03-15 22:31:11 +01:00
$sql .= " " . ( ! isset ( $this -> fk_code_type_resource ) ? 'NULL' : " ' " . $this -> db -> escape ( $this -> fk_code_type_resource ) . " ' " ) . " , " ;
$sql .= " " . ( ! isset ( $this -> note_public ) ? 'NULL' : " ' " . $this -> db -> escape ( $this -> note_public ) . " ' " ) . " , " ;
$sql .= " " . ( ! isset ( $this -> note_private ) ? 'NULL' : " ' " . $this -> db -> escape ( $this -> note_private ) . " ' " );
$sql .= " ) " ;
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
$this -> db -> begin ();
2014-04-23 19:04:10 +02:00
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::create " , LOG_DEBUG );
2014-03-15 22:31:11 +01:00
$resql = $this -> db -> query ( $sql );
if ( ! $resql ) {
$error ++ ; $this -> errors [] = " Error " . $this -> db -> lasterror ();
}
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
if ( ! $error )
{
2015-08-12 21:48:00 +02:00
$this -> id = $this -> db -> last_insert_id ( MAIN_DB_PREFIX . $this -> table_element );
2016-10-19 22:14:51 +02:00
}
if ( ! $error )
{
$action = 'create' ;
2018-04-10 12:03:01 +02:00
// Actions on extra fields
if ( empty ( $conf -> global -> MAIN_EXTRAFIELDS_DISABLED )) // For avoid conflicts if trigger used
{
$result = $this -> insertExtraFields ();
if ( $result < 0 )
{
$error ++ ;
}
2016-10-19 22:14:51 +02:00
}
}
2014-04-23 19:04:10 +02:00
2016-10-19 22:14:51 +02:00
if ( ! $error )
{
2014-03-15 22:31:11 +01:00
if ( ! $notrigger )
2014-04-23 19:04:10 +02:00
{
2014-03-15 22:31:11 +01:00
//// Call triggers
2016-10-19 22:14:51 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php' ;
$interface = new Interfaces ( $this -> db );
2019-01-27 11:55:16 +01:00
$result = $interface -> run_triggers ( 'RESOURCE_CREATE' , $this , $user , $langs , $conf );
2016-10-19 22:14:51 +02:00
if ( $result < 0 ) { $error ++ ; $this -> errors = $interface -> errors ; }
2014-03-15 22:31:11 +01:00
//// End call triggers
}
}
2014-04-23 19:04:10 +02:00
2014-03-15 22:31:11 +01:00
// Commit or rollback
if ( $error )
{
foreach ( $this -> errors as $errmsg )
{
dol_syslog ( get_class ( $this ) . " ::create " . $errmsg , LOG_ERR );
$this -> error .= ( $this -> error ? ', ' . $errmsg : $errmsg );
}
$this -> db -> rollback ();
return - 1 * $error ;
}
else
{
$this -> db -> commit ();
return $this -> id ;
}
}
2014-04-23 19:04:10 +02:00
2014-03-15 23:57:50 +01:00
/**
* Load object in memory from database
*
2017-10-20 23:48:42 +02:00
* @ param int $id Id of object
* @ param string $ref Ref of object
* @ return int < 0 if KO , > 0 if OK
2014-03-15 23:57:50 +01:00
*/
2019-02-28 22:44:12 +01:00
public function fetch ( $id , $ref = '' )
2014-03-15 23:57:50 +01:00
{
global $langs ;
$sql = " SELECT " ;
$sql .= " t.rowid, " ;
$sql .= " t.entity, " ;
$sql .= " t.ref, " ;
$sql .= " t.description, " ;
2017-11-21 23:11:33 +01:00
$sql .= " t.fk_country, " ;
2014-03-15 23:57:50 +01:00
$sql .= " t.fk_code_type_resource, " ;
$sql .= " t.note_public, " ;
$sql .= " t.note_private, " ;
2014-03-23 22:12:48 +01:00
$sql .= " t.tms, " ;
$sql .= " ty.label as type_label " ;
2015-08-12 21:48:00 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . $this -> table_element . " as t " ;
2014-03-23 22:12:48 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_type_resource as ty ON ty.code=t.fk_code_type_resource " ;
2017-10-20 23:48:42 +02:00
if ( $id ) $sql .= " WHERE t.rowid = " . $this -> db -> escape ( $id );
else $sql .= " WHERE t.ref = ' " . $this -> db -> escape ( $ref ) . " ' " ;
2014-04-23 19:04:10 +02:00
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::fetch " , LOG_DEBUG );
2014-03-15 23:57:50 +01:00
$resql = $this -> db -> query ( $sql );
if ( $resql )
{
if ( $this -> db -> num_rows ( $resql ))
{
$obj = $this -> db -> fetch_object ( $resql );
2014-04-23 19:04:10 +02:00
2014-03-15 23:57:50 +01:00
$this -> id = $obj -> rowid ;
$this -> entity = $obj -> entity ;
$this -> ref = $obj -> ref ;
$this -> description = $obj -> description ;
2017-11-21 23:11:33 +01:00
$this -> country_id = $obj -> fk_country ;
2014-03-15 23:57:50 +01:00
$this -> fk_code_type_resource = $obj -> fk_code_type_resource ;
$this -> note_public = $obj -> note_public ;
2014-04-23 19:04:10 +02:00
$this -> note_private = $obj -> note_private ;
2014-03-23 22:12:48 +01:00
$this -> type_label = $obj -> type_label ;
2014-04-23 19:04:10 +02:00
2018-02-20 19:38:18 +01:00
// Retreive all extrafield
2016-10-19 22:14:51 +02:00
// fetch optionals attributes and labels
2018-02-20 19:38:18 +01:00
$this -> fetch_optionals ();
2014-03-15 23:57:50 +01:00
}
$this -> db -> free ( $resql );
2014-04-23 19:04:10 +02:00
2014-03-15 23:57:50 +01:00
return $this -> id ;
}
else
{
$this -> error = " Error " . $this -> db -> lasterror ();
dol_syslog ( get_class ( $this ) . " ::fetch " . $this -> error , LOG_ERR );
return - 1 ;
}
}
2014-04-23 19:04:10 +02:00
2017-11-21 23:11:33 +01:00
2014-03-15 23:57:50 +01:00
/**
* Update object into database
*
* @ param User $user User that modifies
* @ param int $notrigger 0 = launch triggers after , 1 = disable triggers
* @ return int < 0 if KO , > 0 if OK
*/
2019-03-01 23:08:57 +01:00
public function update ( $user = null , $notrigger = 0 )
2017-08-30 11:26:48 +02:00
{
global $conf , $langs , $hookmanager ;
$error = 0 ;
// Clean parameters
if ( isset ( $this -> ref )) $this -> ref = trim ( $this -> ref );
if ( isset ( $this -> fk_code_type_resource )) $this -> fk_code_type_resource = trim ( $this -> fk_code_type_resource );
if ( isset ( $this -> description )) $this -> description = trim ( $this -> description );
2017-11-21 23:11:33 +01:00
if ( ! is_numeric ( $this -> country_id )) $this -> country_id = 0 ;
2017-08-30 11:26:48 +02:00
if ( empty ( $this -> oldcopy ))
{
$org = new self ( $this -> db );
$org -> fetch ( $this -> id );
$this -> oldcopy = $org ;
}
// Update request
$sql = " UPDATE " . MAIN_DB_PREFIX . $this -> table_element . " SET " ;
$sql .= " ref= " . ( isset ( $this -> ref ) ? " ' " . $this -> db -> escape ( $this -> ref ) . " ' " : " null " ) . " , " ;
$sql .= " description= " . ( isset ( $this -> description ) ? " ' " . $this -> db -> escape ( $this -> description ) . " ' " : " null " ) . " , " ;
2017-11-21 23:11:33 +01:00
$sql .= " fk_country= " . ( $this -> country_id > 0 ? $this -> country_id : " null " ) . " , " ;
2017-08-30 11:26:48 +02:00
$sql .= " fk_code_type_resource= " . ( isset ( $this -> fk_code_type_resource ) ? " ' " . $this -> db -> escape ( $this -> fk_code_type_resource ) . " ' " : " null " ) . " , " ;
$sql .= " tms= " . ( dol_strlen ( $this -> tms ) != 0 ? " ' " . $this -> db -> idate ( $this -> tms ) . " ' " : 'null' ) . " " ;
$sql .= " WHERE rowid= " . $this -> id ;
$this -> db -> begin ();
dol_syslog ( get_class ( $this ) . " ::update " , LOG_DEBUG );
$resql = $this -> db -> query ( $sql );
if ( ! $resql ) { $error ++ ; $this -> errors [] = " Error " . $this -> db -> lasterror (); }
if ( ! $error )
{
if ( ! $notrigger )
{
// Call trigger
2019-01-27 11:55:16 +01:00
$result = $this -> call_trigger ( 'RESOURCE_MODIFY' , $user );
2017-08-30 11:26:48 +02:00
if ( $result < 0 ) $error ++ ;
// End call triggers
}
}
if ( ! $error && ( is_object ( $this -> oldcopy ) && $this -> oldcopy -> ref !== $this -> ref ))
{
// We remove directory
if ( ! empty ( $conf -> resource -> dir_output ))
{
$olddir = $conf -> resource -> dir_output . " / " . dol_sanitizeFileName ( $this -> oldcopy -> ref );
$newdir = $conf -> resource -> dir_output . " / " . dol_sanitizeFileName ( $this -> ref );
if ( file_exists ( $olddir ))
{
$res = @ rename ( $olddir , $newdir );
if ( ! $res )
{
$langs -> load ( " errors " );
2019-01-27 11:55:16 +01:00
$this -> error = $langs -> trans ( 'ErrorFailToRenameDir' , $olddir , $newdir );
2017-08-30 11:26:48 +02:00
$error ++ ;
}
}
}
}
if ( ! $error )
{
$action = 'update' ;
2018-04-10 12:03:01 +02:00
// Actions on extra fields
if ( empty ( $conf -> global -> MAIN_EXTRAFIELDS_DISABLED )) // For avoid conflicts if trigger used
2017-08-30 11:26:48 +02:00
{
2018-04-10 12:03:01 +02:00
$result = $this -> insertExtraFields ();
if ( $result < 0 )
2017-08-30 11:26:48 +02:00
{
2018-04-10 12:03:01 +02:00
$error ++ ;
2017-08-30 11:26:48 +02:00
}
}
}
// Commit or rollback
if ( $error )
{
foreach ( $this -> errors as $errmsg )
{
dol_syslog ( get_class ( $this ) . " ::update " . $errmsg , LOG_ERR );
$this -> error .= ( $this -> error ? ', ' . $errmsg : $errmsg );
}
$this -> db -> rollback ();
return - 1 * $error ;
}
else
{
$this -> db -> commit ();
return 1 ;
}
}
2014-04-23 19:04:10 +02:00
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-01-02 07:07:43 +01:00
/**
* Load object in memory from database
2014-04-23 19:04:10 +02:00
*
2014-03-15 18:28:38 +01:00
* @ param int $id id object
2014-01-02 07:07:43 +01:00
* @ return int < 0 if KO , > 0 if OK
*/
2019-02-28 22:44:12 +01:00
public function fetch_element_resource ( $id )
2014-01-02 07:07:43 +01:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2014-01-02 07:07:43 +01:00
global $langs ;
$sql = " SELECT " ;
$sql .= " t.rowid, " ;
$sql .= " t.resource_id, " ;
$sql .= " t.resource_type, " ;
$sql .= " t.element_id, " ;
$sql .= " t.element_type, " ;
$sql .= " t.busy, " ;
$sql .= " t.mandatory, " ;
$sql .= " t.fk_user_create, " ;
$sql .= " t.tms " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " element_resources as t " ;
$sql .= " WHERE t.rowid = " . $this -> db -> escape ( $id );
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::fetch " , LOG_DEBUG );
2014-01-02 07:07:43 +01:00
$resql = $this -> db -> query ( $sql );
if ( $resql )
{
if ( $this -> db -> num_rows ( $resql ))
{
$obj = $this -> db -> fetch_object ( $resql );
$this -> id = $obj -> rowid ;
$this -> resource_id = $obj -> resource_id ;
$this -> resource_type = $obj -> resource_type ;
$this -> element_id = $obj -> element_id ;
$this -> element_type = $obj -> element_type ;
$this -> busy = $obj -> busy ;
$this -> mandatory = $obj -> mandatory ;
$this -> fk_user_create = $obj -> fk_user_create ;
2016-10-19 22:14:51 +02:00
if ( $obj -> resource_id && $obj -> resource_type ) {
2019-01-27 11:55:16 +01:00
$this -> objresource = fetchObjectByElement ( $obj -> resource_id , $obj -> resource_type );
2016-10-19 22:14:51 +02:00
}
if ( $obj -> element_id && $obj -> element_type ) {
2019-01-27 11:55:16 +01:00
$this -> objelement = fetchObjectByElement ( $obj -> element_id , $obj -> element_type );
2016-10-19 22:14:51 +02:00
}
2014-01-02 07:07:43 +01:00
}
$this -> db -> free ( $resql );
return $this -> id ;
}
else
{
$this -> error = " Error " . $this -> db -> lasterror ();
return - 1 ;
}
2014-03-23 23:13:17 +01:00
}
2014-04-23 19:04:10 +02:00
2014-05-11 12:12:17 +02:00
/**
* Delete a resource object
*
* @ param int $rowid Id of resource line to delete
* @ param int $notrigger Disable all triggers
* @ return int > 0 if OK , < 0 if KO
*/
2019-03-01 23:08:57 +01:00
public function delete ( $rowid , $notrigger = 0 )
2017-08-30 11:26:48 +02:00
{
global $user , $langs , $conf ;
2019-05-18 00:47:32 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2017-08-30 11:26:48 +02:00
$error = 0 ;
$this -> db -> begin ();
$sql = " DELETE FROM " . MAIN_DB_PREFIX . $this -> table_element ;
$sql .= " WHERE rowid = " . $rowid ;
dol_syslog ( get_class ( $this ), LOG_DEBUG );
if ( $this -> db -> query ( $sql ))
{
$sql = " DELETE FROM " . MAIN_DB_PREFIX . " element_resources " ;
$sql .= " WHERE element_type='resource' AND resource_id = " . $this -> db -> escape ( $rowid );
dol_syslog ( get_class ( $this ) . " ::delete " , LOG_DEBUG );
$resql = $this -> db -> query ( $sql );
if ( ! $resql )
{
$this -> error = $this -> db -> lasterror ();
$error ++ ;
}
}
else
{
$this -> error = $this -> db -> lasterror ();
$error ++ ;
}
// Removed extrafields
if ( ! $error ) {
$result = $this -> deleteExtraFields ();
if ( $result < 0 )
{
$error ++ ;
dol_syslog ( get_class ( $this ) . " ::delete error -3 " . $this -> error , LOG_ERR );
}
}
if ( ! $notrigger )
{
// Call trigger
2019-01-27 11:55:16 +01:00
$result = $this -> call_trigger ( 'RESOURCE_DELETE' , $user );
2017-08-30 11:26:48 +02:00
if ( $result < 0 ) $error ++ ;
// End call triggers
}
if ( ! $error )
{
// We remove directory
$ref = dol_sanitizeFileName ( $this -> ref );
if ( ! empty ( $conf -> resource -> dir_output ))
{
$dir = $conf -> resource -> dir_output . " / " . dol_sanitizeFileName ( $this -> ref );
if ( file_exists ( $dir ))
{
$res =@ dol_delete_dir_recursive ( $dir );
if ( ! $res )
{
$this -> errors [] = 'ErrorFailToDeleteDir' ;
$error ++ ;
}
}
}
}
if ( ! $error )
{
$this -> db -> commit ();
return 1 ;
}
else
{
$this -> db -> rollback ();
return - 1 ;
}
}
2014-10-30 01:33:39 +01:00
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-03-23 23:13:17 +01:00
/**
* Load resource objects into $this -> lines
*
* @ param string $sortorder sort order
* @ param string $sortfield sort field
* @ param int $limit limit page
* @ param int $offset page
* @ param array $filter filter output
* @ return int < 0 if KO , > 0 if OK
*/
2019-02-28 22:44:12 +01:00
public function fetch_all ( $sortorder , $sortfield , $limit , $offset , $filter = '' )
2014-03-23 23:13:17 +01:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2014-03-23 23:13:17 +01:00
global $conf ;
2019-10-06 14:41:52 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php' ;
$extrafields = new ExtraFields ( $this -> db );
2014-03-23 23:13:17 +01:00
$sql = " SELECT " ;
$sql .= " t.rowid, " ;
$sql .= " t.entity, " ;
$sql .= " t.ref, " ;
$sql .= " t.description, " ;
$sql .= " t.fk_code_type_resource, " ;
$sql .= " t.tms, " ;
2019-10-06 14:41:52 +02:00
// Add fields from extrafields
if ( ! empty ( $extrafields -> attributes [ $this -> table_element ][ 'label' ]))
foreach ( $extrafields -> attributes [ $this -> table_element ][ 'label' ] as $key => $val ) $sql .= ( $extrafields -> attributes [ $this -> table_element ][ 'type' ][ $key ] != 'separate' ? " ef. " . $key . ' as options_' . $key . ', ' : '' );
2014-03-23 23:13:17 +01:00
$sql .= " ty.label as type_label " ;
2015-08-12 21:48:00 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . $this -> table_element . " as t " ;
2014-03-23 23:13:17 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_type_resource as ty ON ty.code=t.fk_code_type_resource " ;
2016-10-19 22:14:51 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this -> table_element . " _extrafields as ef ON ef.fk_object=t.rowid " ;
2017-05-30 18:50:54 +02:00
$sql .= " WHERE t.entity IN ( " . getEntity ( 'resource' ) . " ) " ;
2019-10-06 14:41:52 +02:00
// Manage filter
2014-03-23 23:13:17 +01:00
if ( ! empty ( $filter )){
foreach ( $filter as $key => $value ) {
2019-01-27 11:55:16 +01:00
if ( strpos ( $key , 'date' )) {
2014-03-23 23:13:17 +01:00
$sql .= ' AND ' . $key . ' = \'' . $this -> db -> idate ( $value ) . '\'' ;
}
2019-01-27 11:55:16 +01:00
elseif ( strpos ( $key , 'ef.' ) !== false ){
2016-10-19 22:14:51 +02:00
$sql .= $value ;
}
2014-03-23 23:13:17 +01:00
else {
2019-10-06 14:41:52 +02:00
$sql .= ' AND ' . $key . ' LIKE \'%' . $this -> db -> escape ( $value ) . '%\'' ;
2014-03-23 23:13:17 +01:00
}
}
}
2019-01-27 11:55:16 +01:00
$sql .= $this -> db -> order ( $sortfield , $sortorder );
2015-11-26 20:33:07 +01:00
$this -> num_all = 0 ;
if ( empty ( $conf -> global -> MAIN_DISABLE_FULL_SCANLIST ))
{
$result = $this -> db -> query ( $sql );
$this -> num_all = $this -> db -> num_rows ( $result );
}
if ( $limit ) $sql .= $this -> db -> plimit ( $limit , $offset );
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::fetch_all " , LOG_DEBUG );
2014-04-23 19:04:10 +02:00
2019-05-31 16:04:12 +02:00
$this -> lines = array ();
2014-03-23 23:13:17 +01:00
$resql = $this -> db -> query ( $sql );
if ( $resql )
{
$num = $this -> db -> num_rows ( $resql );
if ( $num )
{
2016-08-17 14:53:51 +02:00
while ( $obj = $this -> db -> fetch_object ( $resql ))
2014-03-23 23:13:17 +01:00
{
2016-01-21 11:18:29 +01:00
$line = new Dolresource ( $this -> db );
2014-03-23 23:13:17 +01:00
$line -> id = $obj -> rowid ;
$line -> ref = $obj -> ref ;
$line -> description = $obj -> description ;
2017-11-21 23:11:33 +01:00
$line -> country_id = $obj -> fk_country ;
2014-03-23 23:13:17 +01:00
$line -> fk_code_type_resource = $obj -> fk_code_type_resource ;
$line -> type_label = $obj -> type_label ;
2014-04-23 19:04:10 +02:00
2016-10-19 22:14:51 +02:00
// fetch optionals attributes and labels
2018-02-21 14:48:25 +01:00
$line -> fetch_optionals ();
2016-10-19 22:14:51 +02:00
2016-08-17 14:53:51 +02:00
$this -> lines [] = $line ;
2014-03-23 23:13:17 +01:00
}
$this -> db -> free ( $resql );
}
return $num ;
}
else
{
$this -> error = $this -> db -> lasterror ();
return - 1 ;
}
2014-01-02 07:07:43 +01:00
}
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-01-02 07:07:43 +01:00
/**
* Load all objects into $this -> lines
*
* @ param string $sortorder sort order
* @ param string $sortfield sort field
* @ param int $limit limit page
* @ param int $offset page
* @ param array $filter filter output
* @ return int < 0 if KO , > 0 if OK
*/
2019-02-28 22:44:12 +01:00
public function fetch_all_resources ( $sortorder , $sortfield , $limit , $offset , $filter = '' )
2014-01-02 07:07:43 +01:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2014-01-02 07:07:43 +01:00
global $conf ;
$sql = " SELECT " ;
$sql .= " t.rowid, " ;
$sql .= " t.resource_id, " ;
$sql .= " t.resource_type, " ;
$sql .= " t.element_id, " ;
$sql .= " t.element_type, " ;
$sql .= " t.busy, " ;
$sql .= " t.mandatory, " ;
$sql .= " t.fk_user_create, " ;
$sql .= " t.tms " ;
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'element_resources as t ' ;
2017-05-30 18:50:54 +02:00
$sql .= " WHERE t.entity IN ( " . getEntity ( 'resource' ) . " ) " ;
2014-01-02 07:07:43 +01:00
//Manage filter
if ( ! empty ( $filter )){
foreach ( $filter as $key => $value ) {
2019-01-27 11:55:16 +01:00
if ( strpos ( $key , 'date' )) {
2014-01-02 07:07:43 +01:00
$sql .= ' AND ' . $key . ' = \'' . $this -> db -> idate ( $value ) . '\'' ;
}
else {
$sql .= ' AND ' . $key . ' LIKE \'%' . $value . '%\'' ;
}
}
}
2019-01-27 11:55:16 +01:00
$sql .= $this -> db -> order ( $sortfield , $sortorder );
if ( $limit ) $sql .= $this -> db -> plimit ( $limit + 1 , $offset );
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::fetch_all " , LOG_DEBUG );
2014-01-02 07:07:43 +01:00
$resql = $this -> db -> query ( $sql );
if ( $resql )
{
$num = $this -> db -> num_rows ( $resql );
if ( $num )
{
2016-08-17 14:53:51 +02:00
while ( $obj = $this -> db -> fetch_object ( $resql ))
2014-01-02 07:07:43 +01:00
{
2016-01-21 11:18:29 +01:00
$line = new Dolresource ( $this -> db );
2014-01-02 07:07:43 +01:00
$line -> id = $obj -> rowid ;
$line -> resource_id = $obj -> resource_id ;
$line -> resource_type = $obj -> resource_type ;
$line -> element_id = $obj -> element_id ;
$line -> element_type = $obj -> element_type ;
$line -> busy = $obj -> busy ;
$line -> mandatory = $obj -> mandatory ;
$line -> fk_user_create = $obj -> fk_user_create ;
if ( $obj -> resource_id && $obj -> resource_type )
2019-01-27 11:55:16 +01:00
$line -> objresource = fetchObjectByElement ( $obj -> resource_id , $obj -> resource_type );
2014-01-02 07:07:43 +01:00
if ( $obj -> element_id && $obj -> element_type )
2019-01-27 11:55:16 +01:00
$line -> objelement = fetchObjectByElement ( $obj -> element_id , $obj -> element_type );
2016-08-17 14:53:51 +02:00
$this -> lines [] = $line ;
2014-01-02 07:07:43 +01:00
}
$this -> db -> free ( $resql );
}
return $num ;
}
else
{
$this -> error = $this -> db -> lasterror ();
return - 1 ;
}
}
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-01-02 07:07:43 +01:00
/**
* Load all objects into $this -> lines
*
* @ param string $sortorder sort order
* @ param string $sortfield sort field
* @ param int $limit limit page
* @ param int $offset page
* @ param array $filter filter output
* @ return int < 0 if KO , > 0 if OK
*/
2019-02-28 22:44:12 +01:00
public function fetch_all_used ( $sortorder , $sortfield , $limit , $offset = 1 , $filter = '' )
2014-01-02 07:07:43 +01:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2014-01-02 07:07:43 +01:00
global $conf ;
2014-04-23 19:04:10 +02:00
2014-03-15 19:46:03 +01:00
if ( ! $sortorder ) $sortorder = " ASC " ;
if ( ! $sortfield ) $sortfield = " t.rowid " ;
2014-04-23 19:04:10 +02:00
2014-01-02 07:07:43 +01:00
$sql = " SELECT " ;
$sql .= " t.rowid, " ;
$sql .= " t.resource_id, " ;
$sql .= " t.resource_type, " ;
$sql .= " t.element_id, " ;
$sql .= " t.element_type, " ;
$sql .= " t.busy, " ;
$sql .= " t.mandatory, " ;
$sql .= " t.fk_user_create, " ;
$sql .= " t.tms " ;
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'element_resources as t ' ;
2017-05-30 18:50:54 +02:00
$sql .= " WHERE t.entity IN ( " . getEntity ( 'resource' ) . " ) " ;
2014-01-02 07:07:43 +01:00
//Manage filter
if ( ! empty ( $filter )){
foreach ( $filter as $key => $value ) {
2019-01-27 11:55:16 +01:00
if ( strpos ( $key , 'date' )) {
2014-01-02 07:07:43 +01:00
$sql .= ' AND ' . $key . ' = \'' . $this -> db -> idate ( $value ) . '\'' ;
}
else {
$sql .= ' AND ' . $key . ' LIKE \'%' . $value . '%\'' ;
}
}
}
2019-01-27 11:55:16 +01:00
$sql .= $this -> db -> order ( $sortfield , $sortorder );
if ( $limit ) $sql .= $this -> db -> plimit ( $limit + 1 , $offset );
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::fetch_all " , LOG_DEBUG );
2014-01-02 07:07:43 +01:00
$resql = $this -> db -> query ( $sql );
if ( $resql )
{
$num = $this -> db -> num_rows ( $resql );
if ( $num )
{
2016-08-17 14:46:15 +02:00
$this -> lines = array ();
while ( $obj = $this -> db -> fetch_object ( $resql ))
2014-01-02 07:07:43 +01:00
{
2016-01-21 11:18:29 +01:00
$line = new Dolresource ( $this -> db );
2014-01-02 07:07:43 +01:00
$line -> id = $obj -> rowid ;
$line -> resource_id = $obj -> resource_id ;
$line -> resource_type = $obj -> resource_type ;
$line -> element_id = $obj -> element_id ;
$line -> element_type = $obj -> element_type ;
$line -> busy = $obj -> busy ;
$line -> mandatory = $obj -> mandatory ;
$line -> fk_user_create = $obj -> fk_user_create ;
2019-01-27 11:55:16 +01:00
$this -> lines [] = fetchObjectByElement ( $obj -> resource_id , $obj -> resource_type );
2014-01-02 07:07:43 +01:00
}
$this -> db -> free ( $resql );
}
return $num ;
}
else
{
$this -> error = $this -> db -> lasterror ();
return - 1 ;
}
}
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-01-02 07:07:43 +01:00
/**
* Fetch all resources available , declared by modules
* Load available resource in array $this -> available_resources
*
* @ return int number of available resources declared by modules
2015-04-23 23:21:06 +02:00
* @ deprecated , remplaced by hook getElementResources
* @ see getElementResources ()
2014-01-02 07:07:43 +01:00
*/
2019-02-28 22:44:12 +01:00
public function fetch_all_available ()
2018-08-15 17:34:35 +02:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2014-01-02 07:07:43 +01:00
global $conf ;
if ( ! empty ( $conf -> modules_parts [ 'resources' ]))
{
$this -> available_resources = ( array ) $conf -> modules_parts [ 'resources' ];
return count ( $this -> available_resources );
}
return 0 ;
}
2014-04-23 19:04:10 +02:00
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-01-02 07:07:43 +01:00
/**
2014-03-15 22:31:11 +01:00
* Update element resource into database
2014-01-02 07:07:43 +01:00
*
* @ param User $user User that modifies
* @ param int $notrigger 0 = launch triggers after , 1 = disable triggers
* @ return int < 0 if KO , > 0 if OK
*/
2019-02-28 22:44:12 +01:00
public function update_element_resource ( $user = null , $notrigger = 0 )
2014-01-02 07:07:43 +01:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2014-01-02 07:07:43 +01:00
global $conf , $langs ;
$error = 0 ;
// Clean parameters
if ( isset ( $this -> resource_id )) $this -> resource_id = trim ( $this -> resource_id );
if ( isset ( $this -> resource_type )) $this -> resource_type = trim ( $this -> resource_type );
if ( isset ( $this -> element_id )) $this -> element_id = trim ( $this -> element_id );
if ( isset ( $this -> element_type )) $this -> element_type = trim ( $this -> element_type );
if ( isset ( $this -> busy )) $this -> busy = trim ( $this -> busy );
if ( isset ( $this -> mandatory )) $this -> mandatory = trim ( $this -> mandatory );
// Update request
$sql = " UPDATE " . MAIN_DB_PREFIX . " element_resources SET " ;
$sql .= " resource_id= " . ( isset ( $this -> resource_id ) ? " ' " . $this -> db -> escape ( $this -> resource_id ) . " ' " : " null " ) . " , " ;
2017-09-15 15:41:07 +02:00
$sql .= " resource_type= " . ( isset ( $this -> resource_type ) ? " ' " . $this -> db -> escape ( $this -> resource_type ) . " ' " : " null " ) . " , " ;
2014-01-02 07:07:43 +01:00
$sql .= " element_id= " . ( isset ( $this -> element_id ) ? $this -> element_id : " null " ) . " , " ;
$sql .= " element_type= " . ( isset ( $this -> element_type ) ? " ' " . $this -> db -> escape ( $this -> element_type ) . " ' " : " null " ) . " , " ;
$sql .= " busy= " . ( isset ( $this -> busy ) ? $this -> busy : " null " ) . " , " ;
$sql .= " mandatory= " . ( isset ( $this -> mandatory ) ? $this -> mandatory : " null " ) . " , " ;
$sql .= " tms= " . ( dol_strlen ( $this -> tms ) != 0 ? " ' " . $this -> db -> idate ( $this -> tms ) . " ' " : 'null' ) . " " ;
2014-04-23 19:04:10 +02:00
2014-01-02 07:07:43 +01:00
$sql .= " WHERE rowid= " . $this -> id ;
$this -> db -> begin ();
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::update " , LOG_DEBUG );
2014-01-02 07:07:43 +01:00
$resql = $this -> db -> query ( $sql );
if ( ! $resql ) { $error ++ ; $this -> errors [] = " Error " . $this -> db -> lasterror (); }
if ( ! $error )
{
if ( ! $notrigger )
{
2014-07-11 16:06:06 +02:00
// Call trigger
2019-01-27 11:55:16 +01:00
$result = $this -> call_trigger ( 'RESOURCE_MODIFY' , $user );
2014-11-05 16:37:07 +01:00
if ( $result < 0 ) $error ++ ;
2014-07-11 16:06:06 +02:00
// End call triggers
2014-01-02 07:07:43 +01:00
}
}
// Commit or rollback
if ( $error )
{
foreach ( $this -> errors as $errmsg )
{
dol_syslog ( get_class ( $this ) . " ::update " . $errmsg , LOG_ERR );
$this -> error .= ( $this -> error ? ', ' . $errmsg : $errmsg );
}
$this -> db -> rollback ();
return - 1 * $error ;
}
else
{
$this -> db -> commit ();
return 1 ;
}
}
2016-05-19 13:25:16 +02:00
/**
2014-01-02 07:07:43 +01:00
* Return an array with resources linked to the element
2016-08-17 14:46:15 +02:00
*
2016-05-19 13:25:16 +02:00
* @ param string $element Element
* @ param int $element_id Id
* @ param string $resource_type Type
* @ return array Aray of resources
2014-01-02 07:07:43 +01:00
*/
2019-02-28 22:44:12 +01:00
public function getElementResources ( $element , $element_id , $resource_type = '' )
2014-01-02 07:07:43 +01:00
{
2019-05-18 15:46:49 +02:00
$resources = array ();
2014-01-02 07:07:43 +01:00
// Links beetween objects are stored in this table
$sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory' ;
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'element_resources' ;
2016-08-17 14:51:25 +02:00
$sql .= " WHERE element_id= " . $element_id . " AND element_type=' " . $this -> db -> escape ( $element ) . " ' " ;
2014-01-02 07:07:43 +01:00
if ( $resource_type )
2019-09-27 11:39:02 +02:00
$sql .= " AND resource_type LIKE '% " . $this -> db -> escape ( $resource_type ) . " %' " ;
2014-01-02 07:07:43 +01:00
$sql .= ' ORDER BY resource_type' ;
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::getElementResources " , LOG_DEBUG );
2019-05-31 16:04:12 +02:00
$resources = array ();
2014-01-02 07:07:43 +01:00
$resql = $this -> db -> query ( $sql );
if ( $resql )
{
$num = $this -> db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num )
{
$obj = $this -> db -> fetch_object ( $resql );
$resources [ $i ] = array (
'rowid' => $obj -> rowid ,
'resource_id' => $obj -> resource_id ,
'resource_type' => $obj -> resource_type ,
'busy' => $obj -> busy ,
'mandatory' => $obj -> mandatory
);
$i ++ ;
}
}
return $resources ;
}
2015-01-06 17:54:36 +01:00
/*
* Return an int number of resources linked to the element
*
* @ return int
*/
2019-02-28 22:44:12 +01:00
public function fetchElementResources ( $element , $element_id )
2014-01-02 07:07:43 +01:00
{
2019-01-27 11:55:16 +01:00
$resources = $this -> getElementResources ( $element , $element_id );
2015-01-06 17:54:36 +01:00
$i = 0 ;
foreach ( $resources as $nb => $resource ) {
2019-01-27 11:55:16 +01:00
$this -> lines [ $i ] = fetchObjectByElement ( $resource [ 'resource_id' ], $resource [ 'resource_type' ]);
2015-01-06 17:54:36 +01:00
$i ++ ;
}
return $i ;
2014-01-02 07:07:43 +01:00
}
2014-04-23 19:04:10 +02:00
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-03-15 23:57:50 +01:00
/**
* Load in cache resource type code ( setup in dictionary )
*
2019-06-29 16:29:32 +02:00
* @ return int Number of lines loaded , 0 if already loaded , < 0 if KO
2014-03-15 23:57:50 +01:00
*/
2019-02-28 22:44:12 +01:00
public function load_cache_code_type_resource ()
2014-03-15 23:57:50 +01:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2014-03-15 23:57:50 +01:00
global $langs ;
2014-04-23 19:04:10 +02:00
2019-06-02 12:16:12 +02:00
if ( is_array ( $this -> cache_code_type_resource ) && count ( $this -> cache_code_type_resource )) return 0 ; // Cache deja charge
2014-04-23 19:04:10 +02:00
2014-03-23 19:21:58 +01:00
$sql = " SELECT rowid, code, label, active " ;
2014-03-15 23:57:50 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " c_type_resource " ;
$sql .= " WHERE active > 0 " ;
$sql .= " ORDER BY rowid " ;
2014-06-12 11:31:53 +02:00
dol_syslog ( get_class ( $this ) . " ::load_cache_code_type_resource " , LOG_DEBUG );
2014-03-15 23:57:50 +01:00
$resql = $this -> db -> query ( $sql );
if ( $resql )
{
$num = $this -> db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num )
{
$obj = $this -> db -> fetch_object ( $resql );
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
2014-03-23 19:21:58 +01:00
$label = ( $langs -> trans ( " ResourceTypeShort " . $obj -> code ) != ( " ResourceTypeShort " . $obj -> code ) ? $langs -> trans ( " ResourceTypeShort " . $obj -> code ) : ( $obj -> label != '-' ? $obj -> label : '' ));
2014-03-23 19:42:01 +01:00
$this -> cache_code_type_resource [ $obj -> rowid ][ 'code' ] = $obj -> code ;
$this -> cache_code_type_resource [ $obj -> rowid ][ 'label' ] = $label ;
$this -> cache_code_type_resource [ $obj -> rowid ][ 'active' ] = $obj -> active ;
2014-03-15 23:57:50 +01:00
$i ++ ;
}
return $num ;
}
else
{
dol_print_error ( $this -> db );
return - 1 ;
}
}
2014-01-02 07:07:43 +01:00
2014-04-23 19:04:10 +02:00
/**
* Return clicable link of object ( with eventually picto )
*
* @ param int $withpicto Add picto into link
* @ param string $option Where point the link ( 'compta' , 'expedition' , 'document' , ... )
* @ param string $get_params Parametres added to url
2017-11-19 16:55:28 +01:00
* @ param int $notooltip 1 = Disable tooltip
2014-04-23 19:04:10 +02:00
* @ return string String with URL
*/
2019-02-28 22:44:12 +01:00
public function getNomUrl ( $withpicto = 0 , $option = '' , $get_params = '' , $notooltip = 0 )
2014-04-23 19:04:10 +02:00
{
global $langs ;
$result = '' ;
2015-01-20 20:45:38 +01:00
$label = $langs -> trans ( " ShowResource " ) . ': ' . $this -> ref ;
2014-04-23 19:04:10 +02:00
2017-11-12 14:21:34 +01:00
$linkstart = '' ;
$linkend = '' ;
2014-04-23 19:04:10 +02:00
if ( $option == '' )
{
2019-01-27 11:55:16 +01:00
$linkstart = '<a href="' . dol_buildpath ( '/resource/card.php' , 1 ) . '?id=' . $this -> id . $get_params . '" title="' . dol_escape_htmltag ( $label , 1 ) . '" class="classfortooltip">' ;
2016-06-06 13:14:05 +02:00
$picto = 'resource' ;
2014-04-23 19:04:10 +02:00
$label = $langs -> trans ( " ShowResource " ) . ': ' . $this -> ref ;
2017-11-12 14:21:34 +01:00
$linkend = '</a>' ;
2014-04-23 19:04:10 +02:00
}
2017-11-12 14:21:34 +01:00
$result .= $linkstart ;
if ( $withpicto ) $result .= img_object (( $notooltip ? '' : $label ), ( $this -> picto ? $this -> picto : 'generic' ), ( $notooltip ? (( $withpicto != 2 ) ? 'class="paddingright"' : '' ) : 'class="' . (( $withpicto != 2 ) ? 'paddingright ' : '' ) . 'classfortooltip"' ), 0 , 0 , $notooltip ? 0 : 1 );
if ( $withpicto != 2 ) $result .= $this -> ref ;
$result .= $linkend ;
2014-04-23 19:04:10 +02:00
return $result ;
}
2017-09-15 15:41:07 +02:00
2017-05-23 13:38:48 +02:00
/**
* Retourne le libelle du status d ' un user ( actif , inactif )
*
* @ param int $mode 0 = libelle long , 1 = libelle court , 2 = Picto + Libelle court , 3 = Picto , 4 = Picto + Libelle long , 5 = Libelle court + Picto
* @ return string Label of status
*/
2019-02-28 22:44:12 +01:00
public function getLibStatut ( $mode = 0 )
2017-05-23 13:38:48 +02:00
{
2019-01-27 11:55:16 +01:00
return $this -> LibStatut ( $this -> status , $mode );
2017-05-23 13:38:48 +02:00
}
2017-09-15 15:41:07 +02:00
2019-02-28 22:44:12 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2017-05-23 13:38:48 +02:00
/**
* Return the status
*
* @ param int $status Id status
* @ param int $mode 0 = long label , 1 = short label , 2 = Picto + short label , 3 = Picto , 4 = Picto + long label , 5 = Short label + Picto , 5 = Long label + Picto
* @ return string Label of status
*/
2019-02-28 22:44:12 +01:00
public static function LibStatut ( $status , $mode = 0 )
2017-05-23 13:38:48 +02:00
{
2018-09-02 20:37:12 +02:00
// phpcs:enable
2017-05-23 13:38:48 +02:00
global $langs ;
2017-09-15 15:41:07 +02:00
2017-05-23 13:38:48 +02:00
return '' ;
2017-09-15 15:41:07 +02:00
}
2014-01-02 07:07:43 +01:00
}