diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 47788fa44c8..e15999c9c12 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -175,6 +175,19 @@ class modMultiCurrency extends DolibarrModules // Main menu entries $this->menu = array(); // List of menus to add $r = 0; + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>$langs->trans('MulticurrencyRateSetup'), + 'mainmenu'=>'', + 'leftmenu'=>'multicurrency', + 'url'=>'/multicurrency/multicurrency_rates.php', + 'langs'=>'multicurrency', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>100, + 'enabled'=>'$conf->multicurrency->enabled', // Define condition to show or hide menu entry. Use '$conf->multicurrency->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->multicurrency->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both + $r++; // Add here entries to declare new menus // diff --git a/htdocs/langs/en_US/multicurrency.lang b/htdocs/langs/en_US/multicurrency.lang index 6cfb6d4c62b..0ff117a3f92 100644 --- a/htdocs/langs/en_US/multicurrency.lang +++ b/htdocs/langs/en_US/multicurrency.lang @@ -20,10 +20,15 @@ MulticurrencyPaymentAmount=Payment amount, original currency AmountToOthercurrency=Amount To (in currency of receiving account) ErrorCallbackNotFound=Callback not found: %s +MulticurrencyErrorCouldNotCreateRate=Unable to create exchange rate "%s" for currency "%s" +MulticurrencyErrorCurrencyCodeNotFound=Currency code not found: "%s" +MulticurrencyErrorCouldNotFetchRate=Exchange rate #%d not found CurrencyRateSetup=Multi-currency exchange rates +MulticurrencyRateSetup=Edit exchange rates MulticurrencyRateDeleted=Exchange rate deleted MulticurrencyDateSync=Date MulticurrencyRate=Exchange rate MulticurrencyCode=Currency code MulticurrencyEntity=Entity +MulticurrencyRateSaved=Exchange rate saved UnknownAction=Unknown action : "%s" diff --git a/htdocs/langs/fr_FR/multicurrency.lang b/htdocs/langs/fr_FR/multicurrency.lang index e445066e6d8..d6fd1cc71bd 100644 --- a/htdocs/langs/fr_FR/multicurrency.lang +++ b/htdocs/langs/fr_FR/multicurrency.lang @@ -20,10 +20,15 @@ MulticurrencyPaymentAmount=Montant du règlement (devise d'origine) AmountToOthercurrency=Montant destination (en devise du compte de réception) ErrorCallbackNotFound=Callback introuvable : %s +MulticurrencyErrorCouldNotCreateRate=Impossible de créer le taux "%s" sur la devise "%s" +MulticurrencyErrorCurrencyCodeNotFound=Code devise introuvable : "%s" +MulticurrencyErrorCouldNotFetchRate=Taux de change %d introuvable CurrencyRateSetup=Taux de change multi-devise +MulticurrencyRateSetup=Modifier les taux de change MulticurrencyRateDeleted=Taux de change supprimé MulticurrencyDateSync=Date MulticurrencyRate=Taux de change MulticurrencyCode=Code devise MulticurrencyEntity=Entité +MulticurrencyRateSaved=Taux de change enregistré UnknownAction=Action non reconnue : "%s" diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 50288459a7d..32393cee9d9 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -762,7 +762,9 @@ class CurrencyRate extends CommonObjectLine $error = 0; $this->rate = price2num($this->rate); if (empty($this->entity) || $this->entity <= 0) $this->entity = $conf->entity; - $now=date('Y-m-d H:i:s'); + + // if no date defined on object, use current date + if (empty($this->date_sync)) $this->date_sync = date('Y-m-d H:i:s'); // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; @@ -772,7 +774,7 @@ class CurrencyRate extends CommonObjectLine $sql .= ' entity'; $sql .= ') VALUES ('; $sql .= ' '.$this->rate.','; - $sql .= ' \'' . $now . '\','; + $sql .= ' \'' . $this->date_sync . '\','; $sql .= ' \'' . $fk_multicurrency . '\','; $sql .= ' \'' . $this->entity . '\''; $sql .= ')'; @@ -871,7 +873,8 @@ class CurrencyRate extends CommonObjectLine // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' rate='.$this->rate; + $sql .= ' rate=' . $this->rate; + if ($this->date_sync) $sql .= ', date_sync="' . $this->db->escape($this->date_sync) . '"'; $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); diff --git a/htdocs/multicurrency/multicurrency_rates.php b/htdocs/multicurrency/multicurrency_rates.php index daf78227a15..2537fac4fe6 100644 --- a/htdocs/multicurrency/multicurrency_rates.php +++ b/htdocs/multicurrency/multicurrency_rates.php @@ -14,8 +14,6 @@ * along with this program. If not, see . */ -// FIXME: conflit entre paramètres d'URL et paramètres POST (action=filter vs. action=add) - /** * \file htdocs/multicurrency/multicurrency_rates.php * \ingroup multicurrency @@ -29,9 +27,10 @@ $res=@include("../main.inc.php"); // For root directory * @var DoliDB $db */ -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); -require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +//require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +//require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +//require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; dol_include_once('/multicompany/class/actions_multicompany.class.php', 'ActionsMulticompany'); /** @var Translate $langs */ $langs->loadLangs(array( @@ -97,7 +96,7 @@ function _handleActions($db, $TVisibleColumn) { function _mainView($db, $TVisibleColumn, $mode='view', $targetId=NULL) { global $langs; $title = $langs->trans('CurrencyRateSetup'); - $limit = 123; + $limit = 1000; $TSQLFilter = array(); foreach ($TVisibleColumn as $colSelect => $colParam) { @@ -139,7 +138,7 @@ function _mainView($db, $TVisibleColumn, $mode='view', $targetId=NULL) { . ' cursor: pointer;' .'}' .'col.small-col {' - . ' width: 10%' + . ' width: 5%' .'}' . ''; @@ -165,6 +164,7 @@ function _mainView($db, $TVisibleColumn, $mode='view', $targetId=NULL) { } echo '' . '
' + . '' . '' @@ -197,7 +197,8 @@ function _mainView($db, $TVisibleColumn, $mode='view', $targetId=NULL) { } // entire form is inside cell because HTML does not allow forms inside tables unless they are inside cells echo '' - .'' + .'' + . _formHiddenInputs($TVisibleColumn) .'' @@ -234,6 +235,7 @@ function _mainView($db, $TVisibleColumn, $mode='view', $targetId=NULL) { // save form (for the row in edit mode) if ($row_is_in_edit_mode) { echo '' + . _formHiddenInputs($TVisibleColumn) . '' . '' . '' + . _formHiddenInputs($TVisibleColumn) . '' . '' . '' . '
'; echo '
' + . _formHiddenInputs($TVisibleColumn) . '' . '' . '