wip
This commit is contained in:
parent
675a17a74c
commit
e6c3eb0ba1
@ -94,7 +94,7 @@ class DolibarrApi
|
|||||||
* @param object $object Object to clean
|
* @param object $object Object to clean
|
||||||
* @return array Array of cleaned object properties
|
* @return array Array of cleaned object properties
|
||||||
*/
|
*/
|
||||||
private function _cleanObjectDatas($object)
|
protected function _cleanObjectDatas($object)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Remove $db object property for object
|
// Remove $db object property for object
|
||||||
@ -222,7 +222,7 @@ class DolibarrApi
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
private static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
|
protected static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
|
||||||
{
|
{
|
||||||
|
|
||||||
// Features/modules to check
|
// Features/modules to check
|
||||||
@ -248,7 +248,7 @@ class DolibarrApi
|
|||||||
* @param string $sqlfilters sqlfilter string
|
* @param string $sqlfilters sqlfilter string
|
||||||
* @return boolean True if valid, False if not valid
|
* @return boolean True if valid, False if not valid
|
||||||
*/
|
*/
|
||||||
private function _checkFilters($sqlfilters)
|
protected function _checkFilters($sqlfilters)
|
||||||
{
|
{
|
||||||
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
|
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
|
||||||
@ -278,7 +278,7 @@ class DolibarrApi
|
|||||||
* @param array $matches Array of found string by regex search
|
* @param array $matches Array of found string by regex search
|
||||||
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||||
*/
|
*/
|
||||||
private static function _forge_criteria_callback($matches)
|
protected static function _forge_criteria_callback($matches)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $db;
|
global $db;
|
||||||
|
|||||||
@ -370,6 +370,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
// We need constructor into function unActivateModule into admin.lib.php
|
// We need constructor into function unActivateModule into admin.lib.php
|
||||||
|
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Enables a module.
|
* Enables a module.
|
||||||
* Inserts all informations into database
|
* Inserts all informations into database
|
||||||
@ -384,6 +385,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
*/
|
*/
|
||||||
protected function _init($array_sql, $options = '')
|
protected function _init($array_sql, $options = '')
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|
||||||
@ -476,6 +478,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Disable function. Deletes the module constants and boxes from the database.
|
* Disable function. Deletes the module constants and boxes from the database.
|
||||||
*
|
*
|
||||||
@ -486,6 +489,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
*/
|
*/
|
||||||
protected function _remove($array_sql, $options = '')
|
protected function _remove($array_sql, $options = '')
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -1044,7 +1048,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
* @param string $reldir Relative directory where to scan files
|
* @param string $reldir Relative directory where to scan files
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
protected function _load_tables($reldir)
|
private function _load_tables($reldir)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
@ -1052,7 +1056,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
$error=0;
|
$error=0;
|
||||||
$dirfound=0;
|
$dirfound=0;
|
||||||
|
|
||||||
if (empty($reldir)) { return 1;
|
if (empty($reldir)) {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php';
|
require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage cheque receipts numbering rules Mint
|
* Class to manage cheque receipts numbering rules Mint
|
||||||
*/
|
*/
|
||||||
class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
|
class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Return next free value
|
* Return next free value
|
||||||
*
|
*
|
||||||
|
|||||||
@ -133,7 +133,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Return next free value
|
* Return next free value
|
||||||
*
|
*
|
||||||
|
|||||||
@ -382,7 +382,7 @@ class modAdherent extends DolibarrModules
|
|||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->removeFromChild(array(), $options);
|
||||||
|
|
||||||
//ODT template
|
//ODT template
|
||||||
/*
|
/*
|
||||||
@ -408,6 +408,6 @@ class modAdherent extends DolibarrModules
|
|||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".$conf->entity.")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->initFromChild($sql, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,18 +204,20 @@ class modAgenda extends DolibarrModules
|
|||||||
// 'target'=>'',
|
// 'target'=>'',
|
||||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
// $r++;
|
// $r++;
|
||||||
$this->menu[$r]=array('fk_menu'=>0,
|
$this->menu[$r]=array(
|
||||||
'type'=>'top',
|
'fk_menu'=>0,
|
||||||
'titre'=>'TMenuAgenda',
|
'type'=>'top',
|
||||||
'mainmenu'=>'agenda',
|
'titre'=>'TMenuAgenda',
|
||||||
'url'=>'/comm/action/index.php',
|
'mainmenu'=>'agenda',
|
||||||
'langs'=>'agenda',
|
'url'=>'/comm/action/index.php',
|
||||||
'position'=>86,
|
'langs'=>'agenda',
|
||||||
'perms'=>'$user->rights->agenda->myactions->read',
|
'position'=>86,
|
||||||
'enabled'=>'$conf->agenda->enabled',
|
'perms'=>'$user->rights->agenda->myactions->read',
|
||||||
'target'=>'',
|
'enabled'=>'$conf->agenda->enabled',
|
||||||
'user'=>2);
|
'target'=>'',
|
||||||
$r++;
|
'user'=>2,
|
||||||
|
);
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->menu[$r]=array('fk_menu'=>'r=0',
|
$this->menu[$r]=array('fk_menu'=>'r=0',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
|
|||||||
@ -224,14 +224,14 @@ class modApi extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
$result=$this->_load_tables('/api/sql/');
|
$result = $this->_load_tables('/api/sql/');
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->initFromChild($sql, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is disabled.
|
* Function called when module is disabled.
|
||||||
@ -241,7 +241,7 @@ class modApi extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function remove($options = '')
|
public function remove($options = '')
|
||||||
{
|
{
|
||||||
// Remove old constants with entity fields different of 0
|
// Remove old constants with entity fields different of 0
|
||||||
$sql = array(
|
$sql = array(
|
||||||
@ -249,6 +249,6 @@ class modApi extends DolibarrModules
|
|||||||
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('API_PRODUCTION_MODE', 1)
|
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('API_PRODUCTION_MODE', 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_remove($sql, $options);
|
return $this->removeFromChild($sql, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -325,10 +325,10 @@ class modAsset extends DolibarrModules
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->removeFromChild(array(), $options);
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->initFromChild($sql, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -210,7 +210,7 @@ class modBanque extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ class modBarcode extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|||||||
@ -145,9 +145,8 @@ class modBlockedLog extends DolibarrModules
|
|||||||
*
|
*
|
||||||
* @return boolean True if already used, otherwise False
|
* @return boolean True if already used, otherwise False
|
||||||
*/
|
*/
|
||||||
function alreadyUsed()
|
public function alreadyUsed()
|
||||||
{
|
{
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||||
$b=new BlockedLog($this->db);
|
$b=new BlockedLog($this->db);
|
||||||
return $b->alreadyUsed(1);
|
return $b->alreadyUsed(1);
|
||||||
@ -162,7 +161,7 @@ class modBlockedLog extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
@ -205,7 +204,7 @@ class modBlockedLog extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function remove($options = '')
|
public function remove($options = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
@ -233,7 +232,7 @@ class modBlockedLog extends DolibarrModules
|
|||||||
|
|
||||||
if ($b->alreadyUsed(1))
|
if ($b->alreadyUsed(1))
|
||||||
{
|
{
|
||||||
$res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error
|
$res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -121,24 +121,24 @@ class modCashDesk extends DolibarrModules
|
|||||||
// 'target'=>'',
|
// 'target'=>'',
|
||||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
// $r++;
|
// $r++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
// Remove permissions and default values
|
// Remove permissions and default values
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -483,7 +483,7 @@ class modCategorie extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|||||||
@ -269,7 +269,7 @@ class modCommande extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -299,6 +299,6 @@ class modCommande extends DolibarrModules
|
|||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order',".$conf->entity.")"
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order',".$conf->entity.")"
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,16 +101,16 @@ class modComptabilite extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Nettoyage avant activation
|
// Nettoyage avant activation
|
||||||
|
|||||||
@ -212,7 +212,7 @@ class modContrat extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -152,7 +152,7 @@ class modDeplacement extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|||||||
@ -96,15 +96,15 @@ class modDocumentGeneration extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
|
|||||||
@ -151,7 +151,7 @@ class modDon extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -308,14 +308,14 @@ class modExpedition extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
|||||||
@ -203,14 +203,14 @@ class modExpenseReport extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories.
|
* It also creates data directories.
|
||||||
*
|
*
|
||||||
* @param string $options Options
|
* @param string $options Options
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class modExternalRss extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class modExternalRss extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function remove($options = '')
|
public function remove($options = '')
|
||||||
{
|
{
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
|
|||||||
@ -347,14 +347,14 @@ class modFacture extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
|||||||
@ -201,14 +201,14 @@ class modFicheinter extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,7 @@ class modHRM extends DolibarrModules
|
|||||||
* @param string $options Enabling module ('', 'noboxes')
|
* @param string $options Enabling module ('', 'noboxes')
|
||||||
* @return int if OK, 0 if KO
|
* @return int if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|||||||
@ -149,14 +149,14 @@ class modLoan extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -142,14 +142,14 @@ class modMailing extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|||||||
@ -130,7 +130,7 @@ class modOauth extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -310,7 +310,7 @@ class modProjet extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
|||||||
@ -265,7 +265,7 @@ class modPropale extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
|||||||
@ -130,7 +130,7 @@ class modReceiptPrinter extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
// Clean before activation
|
// Clean before activation
|
||||||
|
|||||||
@ -363,7 +363,7 @@ class modService extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
|
|||||||
@ -720,12 +720,12 @@ class modSociete extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
public function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -351,14 +351,14 @@ class modStock extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class modTax extends DolibarrModules
|
|||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -138,14 +138,14 @@ class modWebsite extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called when module is enabled.
|
* Function called when module is enabled.
|
||||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
|||||||
@ -137,9 +137,9 @@ class modWorkflow extends DolibarrModules
|
|||||||
* It also creates data directories
|
* It also creates data directories
|
||||||
*
|
*
|
||||||
* @param string $options Options when enabling module ('', 'noboxes')
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
* @return int 1 if OK, 0 if KO
|
* @return int 1 if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class PrintingDriver
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ class PrintingDriver
|
|||||||
* @param integer $maxfilenamelength Max length of value to show
|
* @param integer $maxfilenamelength Max length of value to show
|
||||||
* @return array List of drivers
|
* @return array List of drivers
|
||||||
*/
|
*/
|
||||||
static function listDrivers($db, $maxfilenamelength = 0)
|
public static function listDrivers($db, $maxfilenamelength = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class PrintingDriver
|
|||||||
*
|
*
|
||||||
* @return string Return translation of key PrintingModuleDescXXX where XXX is module name, or $this->desc if not exists
|
* @return string Return translation of key PrintingModuleDescXXX where XXX is module name, or $this->desc if not exists
|
||||||
*/
|
*/
|
||||||
function getDesc()
|
public function getDesc()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("printing");
|
$langs->load("printing");
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class printing_printgcp extends PrintingDriver
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $dolibarr_main_url_root;
|
global $conf, $langs, $dolibarr_main_url_root;
|
||||||
|
|
||||||
@ -89,47 +89,47 @@ class printing_printgcp extends PrintingDriver
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||||
// Token storage
|
// Token storage
|
||||||
$storage = new DoliStorage($this->db, $this->conf);
|
$storage = new DoliStorage($this->db, $this->conf);
|
||||||
//$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
|
//$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||||
// Setup the credentials for the requests
|
// Setup the credentials for the requests
|
||||||
$credentials = new Credentials(
|
$credentials = new Credentials(
|
||||||
$this->google_id,
|
$this->google_id,
|
||||||
$this->google_secret,
|
$this->google_secret,
|
||||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||||
);
|
);
|
||||||
$access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?'HasAccessToken':'NoAccessToken');
|
$access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?'HasAccessToken':'NoAccessToken');
|
||||||
$serviceFactory = new \OAuth\ServiceFactory();
|
$serviceFactory = new \OAuth\ServiceFactory();
|
||||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||||
$token_ok=true;
|
$token_ok=true;
|
||||||
try {
|
try {
|
||||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
$token_ok = false;
|
$token_ok = false;
|
||||||
}
|
}
|
||||||
//var_dump($this->errors);exit;
|
//var_dump($this->errors);exit;
|
||||||
|
|
||||||
$expire = false;
|
$expire = false;
|
||||||
// Is token expired or will token expire in the next 30 seconds
|
// Is token expired or will token expire in the next 30 seconds
|
||||||
if ($token_ok) {
|
if ($token_ok) {
|
||||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Token expired so we refresh it
|
// Token expired so we refresh it
|
||||||
if ($token_ok && $expire) {
|
if ($token_ok && $expire) {
|
||||||
try {
|
try {
|
||||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||||
$refreshtoken = $token->getRefreshToken();
|
$refreshtoken = $token->getRefreshToken();
|
||||||
$token = $apiService->refreshAccessToken($token);
|
$token = $apiService->refreshAccessToken($token);
|
||||||
$token->setRefreshToken($refreshtoken);
|
$token->setRefreshToken($refreshtoken);
|
||||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->google_id != '' && $this->google_secret != '') {
|
if ($this->google_id != '' && $this->google_secret != '') {
|
||||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
||||||
$this->conf[] = array(
|
$this->conf[] = array(
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class printing_printipp extends PrintingDriver
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ class printing_printipp extends PrintingDriver
|
|||||||
*
|
*
|
||||||
* @return int 0 if OK, >0 if KO
|
* @return int 0 if OK, >0 if KO
|
||||||
*/
|
*/
|
||||||
function listAvailablePrinters()
|
public function listAvailablePrinters()
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
*
|
*
|
||||||
* @return string Text with description
|
* @return string Text with description
|
||||||
*/
|
*/
|
||||||
function info()
|
public function info()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
|
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
|
||||||
@ -74,7 +74,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
*
|
*
|
||||||
* @return string Example
|
* @return string Example
|
||||||
*/
|
*/
|
||||||
function getExample()
|
public function getExample()
|
||||||
{
|
{
|
||||||
return $this->prefix."0501-0001";
|
return $this->prefix."0501-0001";
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
*
|
*
|
||||||
* @return boolean false si conflit, true si ok
|
* @return boolean false si conflit, true si ok
|
||||||
*/
|
*/
|
||||||
function canBeActivated()
|
public function canBeActivated()
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
* @param Propal $propal Object commercial proposal
|
* @param Propal $propal Object commercial proposal
|
||||||
* @return string Next value
|
* @return string Next value
|
||||||
*/
|
*/
|
||||||
function getNextValue($objsoc, $propal)
|
public function getNextValue($objsoc, $propal)
|
||||||
{
|
{
|
||||||
global $db,$conf;
|
global $db,$conf;
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
|||||||
* @param Object $objforref Object for number to search
|
* @param Object $objforref Object for number to search
|
||||||
* @return string Next free value
|
* @return string Next free value
|
||||||
*/
|
*/
|
||||||
function getNumRef($objsoc, $objforref)
|
public function getNumRef($objsoc, $objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue($objsoc, $objforref);
|
return $this->getNextValue($objsoc, $objforref);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,10 +44,10 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->invoice = new FactureFournisseur($this->db);
|
$this->invoice = new FactureFournisseur($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,23 +61,23 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function get($id)
|
public function get($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->lire) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Supplier invoice not found');
|
throw new RestException(404, 'Supplier invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->invoice->fetchObjectLinked();
|
$this->invoice->fetchObjectLinked();
|
||||||
return $this->_cleanObjectDatas($this->invoice);
|
return $this->_cleanObjectDatas($this->invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,9 +94,9 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
||||||
* @return array Array of invoice objects
|
* @return array Array of invoice objects
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
|
|
||||||
// Filter by status
|
// Filter by status
|
||||||
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
|
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
|
||||||
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
|
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
|
||||||
if ($status == 'paid') $sql.= " AND t.fk_statut IN (2)";
|
if ($status == 'paid') $sql.= " AND t.fk_statut IN (2)";
|
||||||
@ -137,7 +137,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
{
|
{
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
}
|
}
|
||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* @param array $request_data Request datas
|
* @param array $request_data Request datas
|
||||||
* @return int ID of supplier invoice
|
* @return int ID of supplier invoice
|
||||||
*/
|
*/
|
||||||
function post($request_data = null)
|
public function post($request_data = null)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||||
throw new RestException(401, "Insuffisant rights");
|
throw new RestException(401, "Insuffisant rights");
|
||||||
@ -218,7 +218,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* @param array $request_data Datas
|
* @param array $request_data Datas
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function put($id, $request_data = null)
|
public function put($id, $request_data = null)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -229,9 +229,9 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
throw new RestException(404, 'Supplier invoice not found');
|
throw new RestException(404, 'Supplier invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
if ($field == 'id') continue;
|
if ($field == 'id') continue;
|
||||||
@ -250,7 +250,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* @param int $id Supplier invoice ID
|
* @param int $id Supplier invoice ID
|
||||||
* @return type
|
* @return type
|
||||||
*/
|
*/
|
||||||
function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->supprimer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->supprimer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -260,9 +260,9 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
throw new RestException(404, 'Supplier invoice not found');
|
throw new RestException(404, 'Supplier invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $this->invoice->delete(DolibarrApiAccess::$user) < 0)
|
if( $this->invoice->delete(DolibarrApiAccess::$user) < 0)
|
||||||
{
|
{
|
||||||
@ -296,34 +296,34 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* "notrigger": 0
|
* "notrigger": 0
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function validate($id, $idwarehouse = 0, $notrigger = 0)
|
public function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
|
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
||||||
}
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
|
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'success' => array(
|
'success' => array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
|
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -332,7 +332,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
* @param Object $object Object to clean
|
* @param Object $object Object to clean
|
||||||
* @return array Array of cleaned object properties
|
* @return array Array of cleaned object properties
|
||||||
*/
|
*/
|
||||||
function _cleanObjectDatas($object)
|
private function _cleanObjectDatas($object)
|
||||||
{
|
{
|
||||||
|
|
||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
@ -354,7 +354,7 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function _validate($data)
|
private function _validate($data)
|
||||||
{
|
{
|
||||||
$invoice = array();
|
$invoice = array();
|
||||||
foreach (SupplierInvoices::$FIELDS as $field) {
|
foreach (SupplierInvoices::$FIELDS as $field) {
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
@ -61,7 +61,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function get($id)
|
public function get($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -96,7 +96,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
* @param array $request_data Request datas
|
* @param array $request_data Request datas
|
||||||
* @return int ID of supplier order
|
* @return int ID of supplier order
|
||||||
*/
|
*/
|
||||||
function post($request_data = null)
|
public function post($request_data = null)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||||
throw new RestException(401, "Insuffisant rights");
|
throw new RestException(401, "Insuffisant rights");
|
||||||
@ -223,7 +223,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
* @param array $request_data Datas
|
* @param array $request_data Datas
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function put($id, $request_data = null)
|
public function put($id, $request_data = null)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -255,7 +255,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
* @param int $id Supplier order ID
|
* @param int $id Supplier order ID
|
||||||
* @return type
|
* @return type
|
||||||
*/
|
*/
|
||||||
function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) {
|
if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -300,7 +300,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
* "notrigger": 0
|
* "notrigger": 0
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function validate($id, $idwarehouse = 0, $notrigger = 0)
|
public function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -336,7 +336,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
* @param Object $object Object to clean
|
* @param Object $object Object to clean
|
||||||
* @return array Array of cleaned object properties
|
* @return array Array of cleaned object properties
|
||||||
*/
|
*/
|
||||||
function _cleanObjectDatas($object)
|
private function _cleanObjectDatas($object)
|
||||||
{
|
{
|
||||||
|
|
||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
@ -358,7 +358,7 @@ class SupplierOrders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function _validate($data)
|
private function _validate($data)
|
||||||
{
|
{
|
||||||
$order = array();
|
$order = array();
|
||||||
foreach (SupplierOrders::$FIELDS as $field) {
|
foreach (SupplierOrders::$FIELDS as $field) {
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class PaiementFourn extends Paiement
|
|||||||
|
|
||||||
public $picto = 'payment';
|
public $picto = 'payment';
|
||||||
|
|
||||||
var $statut; //Status of payment. 0 = unvalidated; 1 = validated
|
public $statut; //Status of payment. 0 = unvalidated; 1 = validated
|
||||||
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
||||||
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ class PaiementFourn extends Paiement
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param int $fk_bank Id of bank line associated to payment
|
* @param int $fk_bank Id of bank line associated to payment
|
||||||
* @return int <0 if KO, -2 if not found, >0 if OK
|
* @return int <0 if KO, -2 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id, $ref = '', $fk_bank = '')
|
public function fetch($id, $ref = '', $fk_bank = '')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param Societe $thirdparty Thirdparty
|
* @param Societe $thirdparty Thirdparty
|
||||||
* @return int id of created payment, < 0 if error
|
* @return int id of created payment, < 0 if error
|
||||||
*/
|
*/
|
||||||
function create($user, $closepaidinvoices = 0, $thirdparty = null)
|
public function create($user, $closepaidinvoices = 0, $thirdparty = null)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param int $notrigger No trigger
|
* @param int $notrigger No trigger
|
||||||
* @return int <0 si ko, >0 si ok
|
* @return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function delete($notrigger = 0)
|
public function delete($notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param int $id Id du paiement dont il faut afficher les infos
|
* @param int $id Id du paiement dont il faut afficher les infos
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function info($id)
|
public function info($id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms';
|
$sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
|
||||||
@ -465,7 +465,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param string $filter SQL filter
|
* @param string $filter SQL filter
|
||||||
* @return array Array of supplier invoice id
|
* @return array Array of supplier invoice id
|
||||||
*/
|
*/
|
||||||
function getBillsArray($filter = '')
|
public function getBillsArray($filter = '')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT fk_facturefourn';
|
$sql = 'SELECT fk_facturefourn';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||||
@ -503,12 +503,12 @@ class PaiementFourn extends Paiement
|
|||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @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 Libelle
|
* @return string Libelle
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode = 0)
|
public function getLibStatut($mode = 0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->statut, $mode);
|
return $this->LibStatut($this->statut, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
@ -516,7 +516,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @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 Libelle du statut
|
* @return string Libelle du statut
|
||||||
*/
|
*/
|
||||||
function LibStatut($status, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
@ -570,7 +570,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0)
|
public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
|
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initAsSpecimen($option = '')
|
public function initAsSpecimen($option = '')
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf;
|
global $user,$langs,$conf;
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ class PaiementFourn extends Paiement
|
|||||||
* @param string $mode 'next' for next value or 'last' for last value
|
* @param string $mode 'next' for next value or 'last' for last value
|
||||||
* @return string free ref or last ref
|
* @return string free ref or last ref
|
||||||
*/
|
*/
|
||||||
function getNextNumRef($soc, $mode = 'next')
|
public function getNextNumRef($soc, $mode = 'next')
|
||||||
{
|
{
|
||||||
global $conf, $db, $langs;
|
global $conf, $db, $langs;
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -755,7 +755,7 @@ class PaiementFourn extends Paiement
|
|||||||
*
|
*
|
||||||
* @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs
|
* @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs
|
||||||
*/
|
*/
|
||||||
function getWay()
|
public function getWay()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -776,14 +776,14 @@ class PaiementFourn extends Paiement
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Load the third party of object, from id into this->thirdparty
|
* Load the third party of object, from id into this->thirdparty
|
||||||
*
|
*
|
||||||
* @param int $force_thirdparty_id Force thirdparty id
|
* @param int $force_thirdparty_id Force thirdparty id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch_thirdparty($force_thirdparty_id = 0)
|
public function fetch_thirdparty($force_thirdparty_id = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user