Skip to content
Snippets Groups Projects
Commit 03b882d0 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/compta/facture/list.php
parents 12eb98d2 2b873e34
Branches
Tags
No related merge requests found
......@@ -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 = '';
......
......@@ -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
);
......
......@@ -265,8 +265,14 @@ class modMultiCurrency extends DolibarrModules
$sql = array();
//$this->_load_tables('/multicurrency/sql/');
$res = $this->_init($sql, $options);
return $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);
}
}
}
......@@ -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);
......
......@@ -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);
......
......@@ -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.
......
......@@ -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";
......
......@@ -182,10 +182,12 @@ class MultiCurrency extends CommonObject
{
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);
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment