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)) {
130 $conf->multicurrency =
new stdClass();
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();
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);