diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 085f98b02186a0e3c9b4db84d8b4cae1b42f140a..42a73f0bbde4dcae08f72a28e487072827e50518 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -49,7 +49,10 @@ if (! $error && count($toselect) > $maxformassaction) $error++; } - +if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form +{ + $massaction='presend'; +} if (! $error && $massaction == 'confirm_presend') { $resaction = ''; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index df65e73f67946ef4f708e933a1bf93c5460dd291..3ed34cfd801cbf50e8ec45da009df08173550c79 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -59,6 +59,8 @@ abstract class CommonDocGenerator { global $conf; + $logotouse=$conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo; + return array( 'myuser_lastname'=>$user->lastname, 'myuser_firstname'=>$user->firstname, @@ -75,7 +77,7 @@ abstract class CommonDocGenerator 'myuser_fax'=>$user->office_fax, 'myuser_mobile'=>$user->user_mobile, 'myuser_email'=>$user->email, - 'myuser_logo'=>$user->photo, + 'myuser_logo'=>$logotouse, 'myuser_job'=>$user->job, 'myuser_web'=>'' // url not exist in $user object ); diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index a4875dc16e2cff4314d3a41cef1332f0face06af..1bd1aea6833c16de0aa8387866718464ffdec5e5 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -265,8 +265,14 @@ class modMultiCurrency extends DolibarrModules $sql = array(); //$this->_load_tables('/multicurrency/sql/'); - - return $this->_init($sql, $options); + $res = $this->_init($sql, $options); + + if ($res) + { + $this->createFirstCurrency(); + } + + return $res; } /** @@ -284,5 +290,27 @@ class modMultiCurrency extends DolibarrModules return $this->_remove($sql, $options); } + /** + * Function called when module is enabled + * Create the currency from general setting + * + * @return int 1 if OK, 0 if KO + */ + private function createFirstCurrency() + { + global $conf,$user,$langs; + + if (!MultiCurrency::checkCodeAlreadyExists($conf->currency)) + { + $langs->loadCacheCurrencies(''); + + $multicurrency = new MultiCurrency($this->db); + $multicurrency->code = $conf->currency; + $multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')'; + $r = $multicurrency->create($user); + + if ($r > 0) $multicurrency->addRate(1); + } + } } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 8d7093bfe73a0a880681c2c6a9473924105981b2..e76da5abef38453c94d0132f731bbebf9f3ee267 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -211,7 +211,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $hookmanager->initHooks(array('pdfgeneration')); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $nblignes = count($object->lines); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index da4910a1db01c2522e5fbacc053ce1dee8310139..8142b371975ff29ff9661f532d2feb93754d723b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1012,7 +1012,7 @@ class CommandeFournisseur extends CommonOrder { $this->statut = 3; $this->methode_commande_id = $methode; - $this->date_commande = $this->db->idate($date); + $this->date_commande = $date; // Call trigger $result=$this->call_trigger('ORDER_SUPPLIER_SUBMIT',$user); @@ -1040,7 +1040,7 @@ class CommandeFournisseur extends CommonOrder $error++; $this->error = $langs->trans('NotAuthorized'); $this->errors[] = $langs->trans('NotAuthorized'); - dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR); + dol_syslog(get_class($this)."::commande User not Authorized", LOG_WARNING); } return ($error ? -1 : 1); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 01510e065f62d7ce36bcc1e41e7b63fe33a3ded1..e65b6d1aa2e297f08a927f6affff201b63d7103b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -570,6 +570,7 @@ TextUsedInTheMessageBody=Email body SendAcknowledgementByMail=Send confirmation email EMail=E-mail NoEMail=No email +Email=Email NoMobilePhone=No mobile phone Owner=Owner FollowingConstantsWillBeSubstituted=The following constants will be replaced with the corresponding value. diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 4797f0985e0ecca6acb85dc2c8ab25d85caf8f2f..df472489c3649bc2d6acf9fce0a567dca4595968 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -157,7 +157,7 @@ if ($socid > 0) $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.fk_statut > 0"; - $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND f.fk_soc = $socid"; $sql.= " AND d.buy_price_ht IS NOT NULL"; diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index c2c6ba1bc991086c269d8f9019587b3be7ca22b6..e3570c5285ecea69e7b082405446469c9d432623 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -181,11 +181,13 @@ class MultiCurrency extends CommonObject public function fetch($id, $code = null) { dol_syslog('Currency::fetch', LOG_DEBUG); + + global $conf; $sql = 'SELECT'; $sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' AS c'; - if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\''; + if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\' AND c.entity = '.$conf->entity; else $sql .= ' WHERE c.rowid = ' . $id; dol_syslog(__METHOD__,LOG_DEBUG); @@ -499,7 +501,9 @@ class MultiCurrency extends CommonObject */ public static function getIdFromCode(&$db, $code) { - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\''; + global $conf; + + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\' AND entity = '.$conf->entity; dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index ef8556aeb9c40a293ad1d414c1505e8529090b49..1843506bd79a7878cf1d7f313d30dce819523d45 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -133,7 +133,7 @@ if (($id > 0 || ! empty($ref)) && $action != 'add') */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks