wip
This commit is contained in:
parent
06db81f3c3
commit
675a17a74c
@ -382,7 +382,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
*
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
private function _init($array_sql, $options = '')
|
||||
protected function _init($array_sql, $options = '')
|
||||
{
|
||||
global $conf;
|
||||
$err=0;
|
||||
@ -484,7 +484,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
*
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
private function _remove($array_sql, $options = '')
|
||||
protected function _remove($array_sql, $options = '')
|
||||
{
|
||||
$err=0;
|
||||
|
||||
@ -658,11 +658,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
|
||||
|
||||
$content = dolMd2Html(
|
||||
$content, 'parsedown',
|
||||
$content,
|
||||
'parsedown',
|
||||
array(
|
||||
'doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1),
|
||||
'img/'=>dol_buildpath(strtolower($this->name).'/img/', 1),
|
||||
'images/'=>dol_buildpath(strtolower($this->name).'/imgages/', 1),
|
||||
'doc/' => dol_buildpath(strtolower($this->name).'/doc/', 1),
|
||||
'img/' => dol_buildpath(strtolower($this->name).'/img/', 1),
|
||||
'images/' => dol_buildpath(strtolower($this->name).'/imgages/', 1),
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -671,8 +672,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$content = nl2br($content);
|
||||
}
|
||||
}
|
||||
else // Mostly for internal modules
|
||||
else
|
||||
{
|
||||
// Mostly for internal modules
|
||||
if (! empty($this->descriptionlong)) {
|
||||
if (is_array($this->langfiles)) {
|
||||
foreach($this->langfiles as $val)
|
||||
@ -805,14 +807,20 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$ret='';
|
||||
|
||||
$newversion=preg_replace('/_deprecated/', '', $this->version);
|
||||
if ($newversion == 'experimental') { $ret=($translated?$langs->transnoentitiesnoconv("VersionExperimental"):$newversion);
|
||||
} elseif ($newversion == 'development') { $ret=($translated?$langs->transnoentitiesnoconv("VersionDevelopment"):$newversion);
|
||||
} elseif ($newversion == 'dolibarr') { $ret=DOL_VERSION;
|
||||
} elseif ($newversion) { $ret=$newversion;
|
||||
} else { $ret=($translated?$langs->transnoentitiesnoconv("VersionUnknown"):'unknown');
|
||||
if ($newversion == 'experimental') {
|
||||
$ret=($translated?$langs->transnoentitiesnoconv("VersionExperimental"):$newversion);
|
||||
} elseif ($newversion == 'development') {
|
||||
$ret=($translated?$langs->transnoentitiesnoconv("VersionDevelopment"):$newversion);
|
||||
} elseif ($newversion == 'dolibarr') {
|
||||
$ret=DOL_VERSION;
|
||||
} elseif ($newversion) {
|
||||
$ret=$newversion;
|
||||
} else {
|
||||
$ret=($translated?$langs->transnoentitiesnoconv("VersionUnknown"):'unknown');
|
||||
}
|
||||
|
||||
if (preg_match('/_deprecated/', $this->version)) { $ret.=($translated?' ('.$langs->transnoentitiesnoconv("Deprecated").')':$this->version);
|
||||
if (preg_match('/_deprecated/', $this->version)) {
|
||||
$ret.=($translated?' ('.$langs->transnoentitiesnoconv("Deprecated").')':$this->version);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
@ -825,13 +833,17 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
*/
|
||||
public function isCoreOrExternalModule()
|
||||
{
|
||||
if ($this->version == 'dolibarr' || $this->version == 'dolibarr_deprecated') { return 'core';
|
||||
if ($this->version == 'dolibarr' || $this->version == 'dolibarr_deprecated') {
|
||||
return 'core';
|
||||
}
|
||||
if (! empty($this->version) && ! in_array($this->version, array('experimental','development'))) { return 'external';
|
||||
if (! empty($this->version) && ! in_array($this->version, array('experimental','development'))) {
|
||||
return 'external';
|
||||
}
|
||||
if (! empty($this->editor_name) || ! empty($this->editor_url)) { return 'external';
|
||||
if (! empty($this->editor_name) || ! empty($this->editor_url)) {
|
||||
return 'external';
|
||||
}
|
||||
if ($this->numero >= 100000) { return 'external';
|
||||
if ($this->numero >= 100000) {
|
||||
return 'external';
|
||||
}
|
||||
return 'unknown';
|
||||
}
|
||||
@ -911,11 +923,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
|
||||
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $err++;
|
||||
} else
|
||||
{
|
||||
if (! $resql) {
|
||||
$err++;
|
||||
} else {
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
if ($obj) { return $this->db->jdate($obj->tms);
|
||||
if ($obj) {
|
||||
return $this->db->jdate($obj->tms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -938,15 +951,16 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
|
||||
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $err++;
|
||||
} else
|
||||
{
|
||||
if (! $resql) {
|
||||
$err++;
|
||||
} else {
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
$tmp=array();
|
||||
if ($obj->note) {
|
||||
$tmp=json_decode($obj->note, true);
|
||||
}
|
||||
if ($obj) { return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms));
|
||||
if ($obj) {
|
||||
return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms));
|
||||
}
|
||||
}
|
||||
|
||||
@ -974,7 +988,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
|
||||
dol_syslog(get_class($this)."::_active delete activation constant", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $err++;
|
||||
if (! $resql) {
|
||||
$err++;
|
||||
}
|
||||
|
||||
$note=json_encode(array('authorid'=>(is_object($user)?$user->id:0), 'ip'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])));
|
||||
@ -1029,7 +1044,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
* @param string $reldir Relative directory where to scan files
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function _load_tables($reldir)
|
||||
protected function _load_tables($reldir)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
@ -89,7 +89,7 @@ class modNotification extends DolibarrModules
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options = '')
|
||||
public function init($options = '')
|
||||
{
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
@ -124,40 +124,41 @@ class modPrelevement extends DolibarrModules
|
||||
$this->rights[$r][4] = 'bons';
|
||||
$this->rights[$r][5] = 'credit';
|
||||
|
||||
/* $this->rights[2][0] = 154;
|
||||
/*
|
||||
$this->rights[2][0] = 154;
|
||||
$this->rights[2][1] = 'Setup withdraw account';
|
||||
$this->rights[2][2] = 'w';
|
||||
$this->rights[2][3] = 0;
|
||||
$this->rights[2][4] = 'bons';
|
||||
$this->rights[2][5] = 'configurer';
|
||||
*/
|
||||
*/
|
||||
|
||||
// Menus
|
||||
//-------
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
}
|
||||
// Menus
|
||||
//-------
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf;
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")",
|
||||
);
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")",
|
||||
);
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ class modProduct extends DolibarrModules
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.recuperableonly'=>'VATNPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type'));
|
||||
$this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array(
|
||||
$this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array(
|
||||
'sp.price'=>"PriceQtyMinHT*",
|
||||
'sp.unitprice'=>'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty
|
||||
'sp.remise_percent'=>'DiscountQtyMin'
|
||||
@ -625,20 +625,20 @@ $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options = '')
|
||||
{
|
||||
$this->remove($options);
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,12 +159,12 @@ class modSalaries extends DolibarrModules
|
||||
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
|
||||
@ -360,7 +360,7 @@ class modMyModule extends DolibarrModules
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* 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
|
||||
*/
|
||||
public function init($options = '')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user