28include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
49 $this->numero = 40000;
51 $this->rights_class =
'multicurrency';
55 $this->family =
"technic";
57 $this->module_position =
'40';
60 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
62 $this->
description =
"Module to manage several foreign currencies in prices and documents";
65 $this->version =
'dolibarr';
67 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
71 $this->picto =
'multicurrency';
77 $this->module_parts = array();
81 $this->dirs = array();
84 $this->config_page_url = array(
"multicurrency.php");
87 $this->hidden =
false;
88 $this->depends = array();
89 $this->requiredby = array();
90 $this->conflictwith = array();
91 $this->phpmin = array(7, 0);
92 $this->need_dolibarr_version = array(3, 0);
93 $this->langfiles = array(
"multicurrency");
100 $this->
const = array();
126 $this->tabs = array();
129 if (!isset(
$conf->multicurrency->enabled)) {
131 $conf->multicurrency->enabled = 0;
133 $this->dictionaries = array();
138 $this->boxes = array();
150 $datestart=
dol_mktime(21, 15, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
152 $this->cronjobs = array(
155 'label'=>
'MutltiCurrencyAutoUpdateCurrencies',
157 'class'=>
'multicurrency/class/multicurrency.class.php',
158 'objectname'=>
'MultiCurrency',
159 'method'=>
'syncRates',
160 'parameters'=>
'0,0,cron',
161 'comment'=>
'Update all the currencies using the currencylayer API. An API key needs to be given in the multi-currency module config page',
163 'unitfrequency'=>2678400,
164 'status'=>$statusatinstall,
165 'test'=>
'isModEnabled("cron")',
166 'datestart'=>$datestart
171 $this->rights = array();
183 $this->rights[$r][0] = 40001;
184 $this->rights[$r][1] =
'Read currencies and their rates';
185 $this->rights[$r][2] =
'r';
186 $this->rights[$r][3] = 1;
187 $this->rights[$r][4] =
'currency';
188 $this->rights[$r][5] =
'read';
191 $this->rights[$r][0] = 40002;
192 $this->rights[$r][1] =
'Create/Update currencies and their rates';
193 $this->rights[$r][2] =
'w';
194 $this->rights[$r][3] = 0;
195 $this->rights[$r][4] =
'currency';
196 $this->rights[$r][5] =
'write';
199 $this->rights[$r][0] = 40003;
200 $this->rights[$r][1] =
'Delete currencies and their rates';
201 $this->rights[$r][2] =
'w';
202 $this->rights[$r][3] = 0;
203 $this->rights[$r][4] =
'currency';
204 $this->rights[$r][5] =
'delete';
208 $this->menu = array();
297 public function init($options =
'')
301 $res = $this->
_init($sql, $options);
318 public function remove($options =
'')
322 return $this->
_remove($sql, $options);
333 global
$conf, $user, $langs;
337 if (! $multicurrency->checkCodeAlreadyExists(
$conf->currency)) {
338 $langs->loadCacheCurrencies(
'');
340 $multicurrency->code =
$conf->currency;
341 $multicurrency->name = $langs->cache_currencies[
$conf->currency][
'label'].
' ('.$langs->getCurrencySymbol(
$conf->currency).
')';
342 $r = $multicurrency->create($user);
345 $multicurrency->addRate(1);
_init($array_sql, $options='')
Enables a module.
_remove($array_sql, $options='')
Disable function.
Description and activation class for module MyModule.
init($options='')
Function called when module is enabled.
createFirstCurrency()
Function called when module is enabled Create the currency from general setting.
__construct($db)
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_now($mode='auto')
Return date for now.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db name
Only used if Module[ID]Name translation string is not found.