From 357877b1fe1c3e90cae0feeba5e7af7cf128205e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Tue, 12 Apr 2016 14:10:27 +0200 Subject: [PATCH] Debug multicurrency and clean properties of some modules --- htdocs/admin/multicurrency.php | 6 ++-- htdocs/comm/propal.php | 10 +++--- htdocs/commande/card.php | 6 ++-- htdocs/compta/facture.php | 6 ++-- htdocs/contrat/card.php | 1 + htdocs/core/class/html.form.class.php | 31 +++++++++++++------ htdocs/core/modules/modCategorie.class.php | 3 +- .../modules/modDocumentGeneration.class.php | 2 +- htdocs/core/modules/modExport.class.php | 2 +- htdocs/core/modules/modFckeditor.class.php | 1 + htdocs/core/modules/modImport.class.php | 2 +- htdocs/core/modules/modLabel.class.php | 1 + .../core/modules/modMultiCurrency.class.php | 4 +-- htdocs/core/modules/modWebsites.class.php | 2 +- htdocs/fourn/commande/card.php | 5 +-- htdocs/fourn/facture/card.php | 5 +-- .../install/mysql/migration/3.9.0-4.0.0.sql | 3 +- .../mysql/tables/llx_multicurrency_rate.sql | 3 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/receiptprinter.lang | 2 +- .../class/multicurrency.class.php | 2 ++ htdocs/supplier_proposal/card.php | 6 ++-- 22 files changed, 66 insertions(+), 38 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index b1ad347d8b7..b77606a60ed 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -136,7 +136,7 @@ if ($resql) * View */ -$page_name = "MultiCurrency"; +$page_name = "MultiCurrencySetup"; llxHeader('', $langs->trans($page_name)); @@ -212,7 +212,7 @@ print '<td align="right" width="400">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="set_MULTICURRENCY_MODIFY_RATE_APPLICATION">'; -print $form->selectarray('MULTICURRENCY_MODIFY_RATE_APPLICATION', array('PU_DOLIBARR' => 'PU_DOLIBARR', 'PU_CURRENCY' => 'PU_CURRENCY')); +print $form->selectarray('MULTICURRENCY_MODIFY_RATE_APPLICATION', array('PU_DOLIBARR' => 'PU_DOLIBARR', 'PU_CURRENCY' => 'PU_CURRENCY'), $conf->global->MULTICURRENCY_MODIFY_RATE_APPLICATION); print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '</form>'; print '</td></tr>'; @@ -230,6 +230,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">' print '</form>'; print '</td></tr>'; +/* This property seems not used in code, so i comment it $var=!$var; print '<tr '.$bc[$var].'>'; print '<td>'.$langs->transnoentitiesnoconv("multicurrency_currencyFromToRate").'</td>'; @@ -242,6 +243,7 @@ print '<input type="text" name="MULTICURRENCY_FROM_TO_RATE" value="'.$conf->glob print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '</form>'; print '</td></tr>'; +*/ print '</table>'; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index dea894a0258..d05f9078828 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -911,6 +911,7 @@ if (empty($reshook)) unset($_POST['type']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -1040,6 +1041,7 @@ if (empty($reshook)) unset($_POST['productid']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -1325,7 +1327,7 @@ if ($action == 'create') } } else { print '<td colspan="2">'; - print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1); + print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { @@ -1465,7 +1467,7 @@ if ($action == 'create') print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>'; print '<td colspan="3" class="maxwidthonsmartphone">'; $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); - print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); + print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 1); print '</td></tr>'; } @@ -1978,9 +1980,9 @@ if ($action == 'create') print '</tr></table>'; print '</td><td colspan="5">'; if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); } print '</td></tr>'; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9b5c29f55db..db80893f426 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -833,6 +833,7 @@ if (empty($reshook)) unset($_POST['type']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -963,6 +964,7 @@ if (empty($reshook)) unset($_POST['productid']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -2205,9 +2207,9 @@ if ($action == 'create' && $user->rights->commande->creer) print '</tr></table>'; print '</td><td colspan="5">'; if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); } print '</td></tr>'; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 00498b870a7..491c4ca041a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1522,6 +1522,7 @@ if (empty($reshook)) unset($_POST['type']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -1682,6 +1683,7 @@ if (empty($reshook)) unset($_POST['productid']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -3516,9 +3518,9 @@ else if ($id > 0 || ! empty($ref)) print '</tr></table>'; print '</td><td colspan="3">'; if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); } print '</td></tr>'; } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index b38787a4067..36c79c0f7c5 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -621,6 +621,7 @@ if (empty($reshook)) unset($_POST['type']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 082f362458b..4c32664630f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -902,7 +902,7 @@ class Form * @param string $selected Preselected type * @param string $htmlname Name of field in form * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)') - * @param string $showempty Add an empty field (Can be '1' or text to use on empty line like 'SelectThirdParty') + * @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty') * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box * @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) @@ -3779,7 +3779,7 @@ class Form print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<tr><td>'; - print $this->selectMultiCurrency($selected,$htmlname); + print $this->selectMultiCurrency($selected, $htmlname, 1); print '</td>'; print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '</tr></table></form>'; @@ -3797,11 +3797,13 @@ class Form * @param string $page Page * @param double $rate Current rate * @param string $htmlname Name of select html field + * @param string $currency Currency code to explain the rate * @return void */ - function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx') + function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') { - global $langs; + global $langs, $mysoc, $conf; + if ($htmlname != "none") { print '<form method="POST" action="'.$page.'">'; @@ -3816,7 +3818,15 @@ class Form } else { - print !empty($rate) ? price(price2num($rate), 1, $langs) : 1; + if (! empty($rate)) + { + print price($rate, 1, $langs, 1, 0); + if ($currency && $rate != 1) print ' ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.$conf->currency.')'; + } + else + { + print 1; + } } } @@ -4030,17 +4040,17 @@ class Form * @param integer $useempty 1=Add empty line * @return string */ - function selectMultiCurrency($selected='',$htmlname='multicurrency_code', $useempty=0) + function selectMultiCurrency($selected='', $htmlname='multicurrency_code', $useempty=0) { global $db,$conf,$langs,$user; - $langs->loadCacheCurrencies(''); + $langs->loadCacheCurrencies(''); // Load ->cache_currencies $TCurrency = array(); $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency'; + $sql.= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; $resql = $db->query($sql); - if ($resql) { while ($obj = $db->fetch_object($resql)) $TCurrency[$obj->code] = $obj->code; @@ -4048,14 +4058,14 @@ class Form $out=''; $out.= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; - if ($useempty) $out .= '<option value=""> </option>'; + if ($useempty) $out .= '<option value="'.$conf->currency.'"'.((empty($selected) || $selected == $conf->currency)?' selected="selected"':'').'>'.$langs->cache_currencies[$conf->currency]['label'].'</option>'; if (count($TCurrency) > 0) { foreach ($langs->cache_currencies as $code_iso => $currency) { if (isset($TCurrency[$code_iso])) { - if (!empty($selected) && $selected == $code_iso) $out.= '<option value="'.$code_iso.'" selected>'; + if (!empty($selected) && $selected == $code_iso) $out.= '<option value="'.$code_iso.'" selected="selected">'; else $out.= '<option value="'.$code_iso.'">'; $out.= $currency['label']; @@ -4063,6 +4073,7 @@ class Form $out.= '</option>'; } } + } $out.= '</select>'; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index ad4c2bba16a..17141b6200d 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -45,6 +45,7 @@ class modCategorie extends DolibarrModules $this->numero = 1780; $this->family = "technic"; + $this->module_position = 20; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des categories (produits, clients, fournisseurs...)"; @@ -53,7 +54,7 @@ class modCategorie extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; + $this->special = 0; $this->picto = 'category'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php index 9111ec11099..0648eb8bf0b 100644 --- a/htdocs/core/modules/modDocumentGeneration.class.php +++ b/htdocs/core/modules/modDocumentGeneration.class.php @@ -45,7 +45,7 @@ class modDocumentGeneration extends DolibarrModules $this->numero = 1520; $this->family = "technic"; - $this->module_position = 10000; + $this->module_position = 80; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Direct mail document generation"; diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php index cb3d104e096..e8a6baa8509 100644 --- a/htdocs/core/modules/modExport.class.php +++ b/htdocs/core/modules/modExport.class.php @@ -44,7 +44,7 @@ class modExport extends DolibarrModules $this->numero = 240; $this->family = "technic"; - $this->module_position = 520; + $this->module_position = 72; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Outils d'exports de donnees Dolibarr (via un assistant)"; diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 4735b0811a3..31b3fafff16 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -45,6 +45,7 @@ class modFckeditor extends DolibarrModules $this->numero = 2000; $this->family = "technic"; + $this->module_position = 20; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Editeur WYSIWYG"; diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index 63af9dc9064..8f3faad9bd1 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -44,7 +44,7 @@ class modImport extends DolibarrModules $this->numero = 250; $this->family = "technic"; - $this->module_position = 510; + $this->module_position = 70; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Outils d'imports de donnees Dolibarr (via un assistant)"; diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php index 0b282584261..05e98d36454 100644 --- a/htdocs/core/modules/modLabel.class.php +++ b/htdocs/core/modules/modLabel.class.php @@ -44,6 +44,7 @@ class modLabel extends DolibarrModules $this->numero = 60; $this->family = "technic"; + $this->module_position = 80; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des etiquettes"; diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 48ce8bc3bc0..7ae613edd49 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -52,9 +52,9 @@ class modMultiCurrency extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "financial"; + $this->family = "technic"; // Module position in the family - $this->module_position = 555; + $this->module_position = 40; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); diff --git a/htdocs/core/modules/modWebsites.class.php b/htdocs/core/modules/modWebsites.class.php index 8e019fabed8..e3b500b0e0d 100644 --- a/htdocs/core/modules/modWebsites.class.php +++ b/htdocs/core/modules/modWebsites.class.php @@ -46,7 +46,7 @@ class modWebsites extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "portal"; - $this->module_position = 20; + $this->module_position = 50; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the public website with CMS features"; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8bff36e159e..59bc805a120 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -472,6 +472,7 @@ if (empty($reshook)) unset($_POST['remise_percent']); unset($_POST['pu']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['label']); @@ -2027,9 +2028,9 @@ elseif (! empty($object->id)) print '</tr></table>'; print '</td><td colspan="5">'; if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); } print '</td></tr>'; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d14dd97e6b3..08748bef416 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -830,6 +830,7 @@ if (empty($reshook)) unset($_POST['remise_percent']); unset($_POST['pu']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['label']); @@ -2053,9 +2054,9 @@ else print '</tr></table>'; print '</td><td colspan="3">'; if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); } print '</td></tr>'; } diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 15de62fb3e8..8296aa82e74 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -190,8 +190,7 @@ CREATE TABLE llx_multicurrency_rate rowid integer AUTO_INCREMENT PRIMARY KEY, date_sync datetime DEFAULT NULL, rate double NOT NULL DEFAULT 0, - fk_multicurrency integer NOT NULL, - entity integer NOT NULL DEFAULT 1 + fk_multicurrency integer NOT NULL ) ENGINE=innodb; ALTER TABLE llx_societe ADD COLUMN fk_multicurrency integer; diff --git a/htdocs/install/mysql/tables/llx_multicurrency_rate.sql b/htdocs/install/mysql/tables/llx_multicurrency_rate.sql index e6b90382dcd..333f5deab52 100644 --- a/htdocs/install/mysql/tables/llx_multicurrency_rate.sql +++ b/htdocs/install/mysql/tables/llx_multicurrency_rate.sql @@ -22,6 +22,5 @@ CREATE TABLE llx_multicurrency_rate rowid integer AUTO_INCREMENT PRIMARY KEY, date_sync datetime DEFAULT NULL, rate double NOT NULL DEFAULT 0, - fk_multicurrency integer NOT NULL, - entity integer DEFAULT 1 + fk_multicurrency integer NOT NULL ) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3468dc43eee..b37083ca091 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -99,6 +99,7 @@ AntiVirusParamExample= Example for ClamWin: --database="C:\Program Files (x86)\C ComptaSetup=Accounting module setup UserSetup=User management setup MenuSetup=Menu management setup +MultiCurrencySetup=Multi-currency setup MenuLimits=Limits and accuracy MenuIdParent=Parent menu ID DetailMenuIdParent=ID of parent menu (empty for a top menu) diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang index 7b52f072eaf..189a8f25e38 100644 --- a/htdocs/langs/en_US/receiptprinter.lang +++ b/htdocs/langs/en_US/receiptprinter.lang @@ -5,7 +5,7 @@ PrinterUpdated=Printer %s updated PrinterDeleted=Printer %s deleted TestSentToPrinter=Test Sent To Printer %s ReceiptPrinter=Receipt printers -ReceiptPrinterDesc=Setup of printers +ReceiptPrinterDesc=Setup of receipt printers ReceiptPrinterTemplateDesc=Setup of Templates ReceiptPrinterTypeDesc=Description of Receipt Printer's type ReceiptPrinterProfileDesc=Description of Receipt Printer's Profile diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index fd6da3816ea..834d5b38605 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -471,7 +471,9 @@ class MultiCurrency extends CommonObject { $sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; + // FIXME Is this comptible with SQL ? $sql.= ' WHERE m.code = "'.$db->escape($code).'" AND mc.date_sync >= ALL (SELECT date_sync FROM '.MAIN_DB_PREFIX.'multicurrency_rate)'; + $sql.= " AND m.entity IN '".getEntity('multicurrency', 1)."'"; $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate); else return array(0, 1); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index be07d022fdb..9101b6efda2 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -717,6 +717,7 @@ if (empty($reshook)) unset($_POST['type']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -841,6 +842,7 @@ if (empty($reshook)) unset($_POST['productid']); unset($_POST['remise_percent']); unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); unset($_POST['tva_tx']); unset($_POST['product_ref']); @@ -1549,9 +1551,9 @@ if ($action == 'create') print '</tr></table>'; print '</td><td colspan="3">'; if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none'); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); } print '</td></tr>'; } -- GitLab