';
// Execute hooks
@@ -529,6 +533,7 @@ class FormFile
$out.= ($param?'&'.$param:'');
$out.= '">'.img_printer().'';
}
+ if (is_object($hookmanager)) $out.= $hookmanager->executeHooks('formBuilddocLineOptions',$parameters,$file);
}
$out.= '';
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index d8366a0135d..255b2c6e66f 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -56,15 +56,16 @@ class DoliDBPgsql
//! >=1 if a transaction is opened, 0 otherwise
var $transaction_opened;
var $lastquery;
- var $lastqueryerror; // Ajout d'une variable en cas d'erreur
-
+ // Saved last error
+ var $lastqueryerror;
+ var $lasterror;
+ var $lasterrno;
+
var $unescapeslashquot=0; // By default we do not force the unescape of \'. This is used only to process sql with mysql escaped data.
var $standard_conforming_strings=1; // Database has option standard_conforming_strings to on
var $ok;
var $error;
- var $lasterror;
-
/**
@@ -597,17 +598,17 @@ class DoliDBPgsql
{
if (! $ret)
{
- if ($this->errno() != 'DB_ERROR_25P02')
+ if ($this->errno() != 'DB_ERROR_25P02') // Do not overwrite errors if this is a consecutive error
{
$this->lastqueryerror = $query;
$this->lasterror = $this->error();
$this->lasterrno = $this->errno();
}
- dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." = ".$this->errno(), LOG_WARNING);
+ dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." => ".$this->errno(), LOG_WARNING);
//print "\n>> ".$query." \n";
//print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror." \n";
- if ($usesavepoint && $this->transaction_opened)
+ if ($usesavepoint && $this->transaction_opened) // Warning, after that errno will be erased
{
@pg_query($this->db, 'ROLLBACK TO SAVEPOINT mysavepoint');
}
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index b2073ff314f..02cb6e663e2 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1236,16 +1236,19 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$
* @param string $modulepart Module of document
* @param string $original_file Relative path with filename
* @param string $entity Restrict onto entity
+ * @param User $fuser User object (forced)
* @param string $refname Ref of object to check permission for external users (autodetect if not provided)
* @return mixed Array with access information : accessallowed & sqlprotectagainstexternals & original_file (as full path name)
*/
-function dol_check_secure_access_document($modulepart,$original_file,$entity,$refname='')
+function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='')
{
global $user, $conf, $db;
+ if (! is_object($fuser)) $fuser=$user;
+
if (empty($modulepart)) return 'ErrorBadParameter';
if (empty($entity)) $entity=0;
- dol_syslog('$modulepart='.$modulepart.' $original_file= '.$original_file);
+ dol_syslog('modulepart='.$modulepart.' original_file= '.$original_file);
// We define $accessallowed and $sqlprotectagainstexternals
$accessallowed=0;
$sqlprotectagainstexternals='';
@@ -1253,7 +1256,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// find the subdirectory name as the reference
if (empty($refname)) $refname=basename(dirname($original_file)."/");
-
+
// Wrapping for some images
if ($modulepart == 'companylogo')
{
@@ -1275,101 +1278,101 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les apercu factures
elseif ($modulepart == 'apercufacture')
{
- if ($user->rights->facture->lire) $accessallowed=1;
+ if ($fuser->rights->facture->lire) $accessallowed=1;
$original_file=$conf->facture->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu propal
elseif ($modulepart == 'apercupropal')
{
- if ($user->rights->propale->lire) $accessallowed=1;
+ if ($fuser->rights->propale->lire) $accessallowed=1;
$original_file=$conf->propal->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu commande
elseif ($modulepart == 'apercucommande')
{
- if ($user->rights->commande->lire) $accessallowed=1;
+ if ($fuser->rights->commande->lire) $accessallowed=1;
$original_file=$conf->commande->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu intervention
elseif ($modulepart == 'apercufichinter')
{
- if ($user->rights->ficheinter->lire) $accessallowed=1;
+ if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
}
// Wrapping pour les images des stats propales
elseif ($modulepart == 'propalstats')
{
- if ($user->rights->propale->lire) $accessallowed=1;
+ if ($fuser->rights->propale->lire) $accessallowed=1;
$original_file=$conf->propal->dir_temp.'/'.$original_file;
}
// Wrapping pour les images des stats commandes
elseif ($modulepart == 'orderstats')
{
- if ($user->rights->commande->lire) $accessallowed=1;
+ if ($fuser->rights->commande->lire) $accessallowed=1;
$original_file=$conf->commande->dir_temp.'/'.$original_file;
}
elseif ($modulepart == 'orderstatssupplier')
{
- if ($user->rights->fournisseur->commande->lire) $accessallowed=1;
+ if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1;
$original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file;
}
// Wrapping pour les images des stats factures
elseif ($modulepart == 'billstats')
{
- if ($user->rights->facture->lire) $accessallowed=1;
+ if ($fuser->rights->facture->lire) $accessallowed=1;
$original_file=$conf->facture->dir_temp.'/'.$original_file;
}
elseif ($modulepart == 'billstatssupplier')
{
- if ($user->rights->fournisseur->facture->lire) $accessallowed=1;
+ if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1;
$original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file;
}
// Wrapping pour les images des stats expeditions
elseif ($modulepart == 'expeditionstats')
{
- if ($user->rights->expedition->lire) $accessallowed=1;
+ if ($fuser->rights->expedition->lire) $accessallowed=1;
$original_file=$conf->expedition->dir_temp.'/'.$original_file;
}
// Wrapping pour les images des stats expeditions
elseif ($modulepart == 'tripsexpensesstats')
{
- if ($user->rights->deplacement->lire) $accessallowed=1;
+ if ($fuser->rights->deplacement->lire) $accessallowed=1;
$original_file=$conf->deplacement->dir_temp.'/'.$original_file;
}
// Wrapping pour les images des stats expeditions
elseif ($modulepart == 'memberstats')
{
- if ($user->rights->adherent->lire) $accessallowed=1;
+ if ($fuser->rights->adherent->lire) $accessallowed=1;
$original_file=$conf->adherent->dir_temp.'/'.$original_file;
}
// Wrapping pour les images des stats produits
elseif (preg_match('/^productstats_/i',$modulepart))
{
- if ($user->rights->produit->lire || $user->rights->service->lire) $accessallowed=1;
+ if ($fuser->rights->produit->lire || $fuser->rights->service->lire) $accessallowed=1;
$original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file;
}
// Wrapping for products or services
elseif ($modulepart == 'tax')
{
- if ($user->rights->tax->charges->lire) $accessallowed=1;
+ if ($fuser->rights->tax->charges->lire) $accessallowed=1;
$original_file=$conf->tax->dir_output.'/'.$original_file;
}
// Wrapping for products or services
elseif ($modulepart == 'actions')
{
- if ($user->rights->agenda->myactions->read) $accessallowed=1;
+ if ($fuser->rights->agenda->myactions->read) $accessallowed=1;
$original_file=$conf->agenda->dir_output.'/'.$original_file;
}
// Wrapping for categories
elseif ($modulepart == 'category')
{
- if ($user->rights->categorie->lire) $accessallowed=1;
+ if ($fuser->rights->categorie->lire) $accessallowed=1;
$original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file;
}
// Wrapping pour les prelevements
elseif ($modulepart == 'prelevement')
{
- if ($user->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1412,7 +1415,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
elseif ($modulepart == 'scanner_user_temp')
{
$accessallowed=1;
- $original_file=$conf->scanner->dir_temp.'/'.$user->id.'/'.$original_file;
+ $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
}
// Wrapping pour les images fckeditor
elseif ($modulepart == 'fckeditor')
@@ -1424,7 +1427,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping for third parties
else if ($modulepart == 'company' || $modulepart == 'societe')
{
- if ($user->rights->societe->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->societe->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1435,7 +1438,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping for invoices
else if ($modulepart == 'facture' || $modulepart == 'invoice')
{
- if ($user->rights->facture->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1445,7 +1448,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
else if ($modulepart == 'unpaid')
{
- if ($user->rights->facture->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1455,7 +1458,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les fiches intervention
else if ($modulepart == 'ficheinter')
{
- if ($user->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1466,7 +1469,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les deplacements et notes de frais
else if ($modulepart == 'deplacement')
{
- if ($user->rights->deplacement->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->deplacement->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1476,7 +1479,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les propales
else if ($modulepart == 'propal')
{
- if ($user->rights->propale->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->propale->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1488,7 +1491,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les commandes
else if ($modulepart == 'commande' || $modulepart == 'order')
{
- if ($user->rights->commande->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->commande->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1499,7 +1502,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les projets
else if ($modulepart == 'project')
{
- if ($user->rights->projet->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1510,7 +1513,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les commandes fournisseurs
else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier')
{
- if ($user->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1521,7 +1524,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les factures fournisseurs
else if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier')
{
- if ($user->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1532,18 +1535,18 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les rapport de paiements
else if ($modulepart == 'facture_paiement')
{
- if ($user->rights->facture->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
- if ($user->societe_id > 0) $original_file=$conf->facture->dir_output.'/payments/private/'.$user->id.'/'.$original_file;
+ if ($fuser->societe_id > 0) $original_file=$conf->facture->dir_output.'/payments/private/'.$fuser->id.'/'.$original_file;
else $original_file=$conf->facture->dir_output.'/payments/'.$original_file;
}
// Wrapping pour les exports de compta
else if ($modulepart == 'export_compta')
{
- if ($user->rights->compta->ventilation->creer || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->compta->ventilation->creer || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1553,7 +1556,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les expedition
else if ($modulepart == 'expedition')
{
- if ($user->rights->expedition->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->expedition->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1563,7 +1566,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les bons de livraison
else if ($modulepart == 'livraison')
{
- if ($user->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1573,7 +1576,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les actions
else if ($modulepart == 'actions')
{
- if ($user->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1583,7 +1586,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les actions
else if ($modulepart == 'actionsreport')
{
- if ($user->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1593,7 +1596,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les produits et services
else if ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service')
{
- if (($user->rights->produit->lire || $user->rights->service->lire) || preg_match('/^specimen/i',$original_file))
+ if (($fuser->rights->produit->lire || $fuser->rights->service->lire) || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1604,7 +1607,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les contrats
else if ($modulepart == 'contract')
{
- if ($user->rights->contrat->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->contrat->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1614,7 +1617,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les dons
else if ($modulepart == 'donation')
{
- if ($user->rights->don->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1624,7 +1627,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les remises de cheques
else if ($modulepart == 'remisecheque')
{
- if ($user->rights->banque->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->banque->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1638,7 +1641,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Aucun test necessaire car on force le rep de download sur
// le rep export qui est propre a l'utilisateur
$accessallowed=1;
- $original_file=$conf->export->dir_temp.'/'.$user->id.'/'.$original_file;
+ $original_file=$conf->export->dir_temp.'/'.$fuser->id.'/'.$original_file;
}
// Wrapping for import module
@@ -1662,7 +1665,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour les backups
else if ($modulepart == 'systemtools')
{
- if ($user->admin)
+ if ($fuser->admin)
{
$accessallowed=1;
}
@@ -1672,7 +1675,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping for upload file test
else if ($modulepart == 'admin_temp')
{
- if ($user->admin)
+ if ($fuser->admin)
$accessallowed=1;
$original_file=$conf->admin->dir_temp.'/'.$original_file;
}
@@ -1689,7 +1692,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Wrapping pour Foundation module
else if ($modulepart == 'member')
{
- if ($user->rights->adherent->lire || preg_match('/^specimen/i',$original_file))
+ if ($fuser->rights->adherent->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
@@ -1700,7 +1703,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
else if ($modulepart == 'scanner_user_temp')
{
$accessallowed=1;
- $original_file=$conf->scanner->dir_temp.'/'.$user->id.'/'.$original_file;
+ $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
}
// GENERIC Wrapping
@@ -1713,18 +1716,18 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
// Define $accessallowed
if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg))
{
- if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1;
- $original_file=$conf->$reg[1]->dir_temp.'/'.$user->id.'/'.$original_file;
+ if ($fuser->rights->$reg[1]->lire || $fuser->rights->$reg[1]->read || ($fuser->rights->$reg[1]->download)) $accessallowed=1;
+ $original_file=$conf->$reg[1]->dir_temp.'/'.$fuser->id.'/'.$original_file;
}
else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg))
{
- if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1;
+ if ($fuser->rights->$reg[1]->lire || $fuser->rights->$reg[1]->read || ($fuser->rights->$reg[1]->download)) $accessallowed=1;
$original_file=$conf->$reg[1]->dir_temp.'/'.$original_file;
}
else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg))
{
- if ($user->rights->$reg[1]->lire || $user->rights->$reg[1]->read || ($user->rights->$reg[1]->download)) $accessallowed=1;
- $original_file=$conf->$reg[1]->dir_output.'/'.$user->id.'/'.$original_file;
+ if ($fuser->rights->$reg[1]->lire || $fuser->rights->$reg[1]->read || ($fuser->rights->$reg[1]->download)) $accessallowed=1;
+ $original_file=$conf->$reg[1]->dir_output.'/'.$fuser->id.'/'.$original_file;
}
else
{
@@ -1732,24 +1735,24 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
$subperm=GETPOST('subperm');
if ($perm || $subperm)
{
- if (($perm && ! $subperm && $user->rights->$modulepart->$perm) || ($perm && $subperm && $user->rights->$modulepart->$perm->$subperm)) $accessallowed=1;
+ if (($perm && ! $subperm && $fuser->rights->$modulepart->$perm) || ($perm && $subperm && $fuser->rights->$modulepart->$perm->$subperm)) $accessallowed=1;
$original_file=$conf->$modulepart->dir_output.'/'.$original_file;
}
else
{
- if ($user->rights->$modulepart->lire || $user->rights->$modulepart->read) $accessallowed=1;
+ if ($fuser->rights->$modulepart->lire || $fuser->rights->$modulepart->read) $accessallowed=1;
$original_file=$conf->$modulepart->dir_output.'/'.$original_file;
}
}
if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a specimen
- if ($user->admin) $accessallowed=1; // If user is admin
+ if ($fuser->admin) $accessallowed=1; // If user is admin
// For modules who wants to manage different levels of permissions for documents
$subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS';
if (! empty($conf->global->$subPermCategoryConstName))
{
$subPermCategory = $conf->global->$subPermCategoryConstName;
- if (! empty($subPermCategory) && (($user->rights->$modulepart->$subPermCategory->lire) || ($user->rights->$modulepart->$subPermCategory->read) || ($user->rights->$modulepart->$subPermCategory->download)))
+ if (! empty($subPermCategory) && (($fuser->rights->$modulepart->$subPermCategory->lire) || ($fuser->rights->$modulepart->$subPermCategory->read) || ($fuser->rights->$modulepart->$subPermCategory->download)))
{
$accessallowed=1;
}
@@ -1763,7 +1766,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$re
eval('$sqlprotectagainstexternals = "'.$conf->global->$sqlProtectConstName.'";');
}
}
-
+
$ret = array(
'accessallowed' => $accessallowed,
'sqlprotectagainstexternals'=>$sqlprotectagainstexternals,
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 32010ceb0de..e5ea867d0a7 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -53,7 +53,7 @@ function project_prepare_head($object)
|| ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled))
{
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id;
- $head[$h][1] = $langs->trans("Referers");
+ $head[$h][1] = $langs->trans("ProjectReferers");
$head[$h][2] = 'element';
$h++;
}
@@ -644,4 +644,4 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0)
print "";
}
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index ceaa41b404c..fa0e48556c8 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -198,6 +198,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
-- Check deposit
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index faccc410219..2f870665bf2 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -523,7 +523,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1);
//if (function_exists('xdebug_is_enabled')) $newmenu->add('/admin/system/xdebug.php', $langs->trans('XDebug'),1);
$newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
-
$newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"),1);
$newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"),1);
$newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"),1);
@@ -534,6 +533,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('About'), 1);
$newmenu->add("/support/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp');
}
+
// Modules system tools
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS))
{
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index 541de648360..6e623d183d2 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -893,11 +893,12 @@ abstract class DolibarrModules
if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS")
{
$this->error=$this->db->lasterror();
- dol_syslog(get_class($this)."::insert_permissions error ".$this->error, LOG_ERR);
+ dol_syslog(get_class($this)."::insert_permissions errno = ".$this->db->errno()." error ".$this->error, LOG_ERR);
$err++;
break;
}
else dol_syslog(get_class($this)."::insert_permissions record already exists", LOG_INFO);
+
}
$this->db->free($resqlinsert);
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index d3611f2bea8..dbc7cdd8c9f 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -55,7 +55,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$langs->load("companies");
$this->db = $db;
- $this->name = "ODT templates";
+ $this->name = "ODT/ODS templates";
$this->description = $langs->trans("DocumentModelOdt");
$this->scandir = 'FACTURE_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
@@ -114,6 +114,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
'object_source_invoice_ref'=>$invoice_source->ref,
'object_hour'=>dol_print_date($object->date,'hour'),
'object_date'=>dol_print_date($object->date,'day'),
+ 'object_date_rfc'=>dol_print_date($object->date,'dayrfc'),
'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'),
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''),
@@ -220,7 +221,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
else
{
- $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
+ $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
}
}
diff --git a/htdocs/document.php b/htdocs/document.php
index 15ac9d0d9ca..9815bbdd7e6 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -178,4 +178,4 @@ header('Pragma: public');
readfile($original_file_osencoded);
-?>
+if (is_object($db)) $db->close();
diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
index b7a12f34262..e1285d52c1a 100755
--- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
+++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
@@ -66,4 +66,4 @@ ALTER TABLE llx_propaldet_extrafields ADD INDEX idx_propaldet_extrafields (fk_ob
DROP table llx_adherent_options;
DROP table llx_adherent_options_label;
-
+ALTER TABLE llx_user ADD accountancy_code VARCHAR( 24 ) NULL;
diff --git a/htdocs/install/mysql/tables/llx_cronjob.sql b/htdocs/install/mysql/tables/llx_cronjob.sql
index ae7fddc28be..6c83994a936 100644
--- a/htdocs/install/mysql/tables/llx_cronjob.sql
+++ b/htdocs/install/mysql/tables/llx_cronjob.sql
@@ -1,51 +1,51 @@
--- ===================================================================
--- Copyright (C) 2013 Laurent Destailleur
--- Copyright (C) 2013 Florian Henry
---
--- This program is free software; you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation; either version 3 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see .
---
--- ===================================================================
-
-
-CREATE TABLE llx_cronjob
-(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- tms timestamp,
- datec datetime,
- jobtype varchar(10) NOT NULL,
- label text NOT NULL,
- command varchar(255),
- classesname varchar(255),
- objectname varchar(255),
- methodename varchar(255),
- params text NOT NULL,
- md5params varchar(32),
- module_name varchar(255),
- priority integer DEFAULT 0,
- datelastrun datetime,
- datenextrun datetime,
- datestart datetime,
- dateend datetime,
- datelastresult datetime,
- lastresult text,
- lastoutput text,
- unitfrequency integer NOT NULL DEFAULT 0,
- frequency integer NOT NULL DEFAULT 0,
- nbrun integer,
- status integer NOT NULL DEFAULT 1,
- fk_user_author integer DEFAULT NULL,
- fk_user_mod integer DEFAULT NULL,
- note text
-
+-- ===================================================================
+-- Copyright (C) 2013 Laurent Destailleur
+-- Copyright (C) 2013 Florian Henry
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+--
+-- ===================================================================
+
+
+CREATE TABLE llx_cronjob
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp,
+ datec datetime,
+ jobtype varchar(10) NOT NULL,
+ label text NOT NULL,
+ command varchar(255),
+ classesname varchar(255),
+ objectname varchar(255),
+ methodename varchar(255),
+ params text NOT NULL,
+ md5params varchar(32),
+ module_name varchar(255),
+ priority integer DEFAULT 0,
+ datelastrun datetime,
+ datenextrun datetime,
+ datestart datetime,
+ dateend datetime,
+ datelastresult datetime,
+ lastresult text,
+ lastoutput text,
+ unitfrequency integer NOT NULL DEFAULT 0,
+ frequency integer NOT NULL DEFAULT 0,
+ nbrun integer,
+ status integer NOT NULL DEFAULT 1,
+ fk_user_author integer DEFAULT NULL,
+ fk_user_mod integer DEFAULT NULL,
+ note text
+
)ENGINE=innodb;
\ No newline at end of file
diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql
index 6042b0906ce..9fd1db59c91 100644
--- a/htdocs/install/mysql/tables/llx_user.sql
+++ b/htdocs/install/mysql/tables/llx_user.sql
@@ -62,5 +62,6 @@ create table llx_user
statut tinyint DEFAULT 1,
photo varchar(255), -- filename or url of photo
lang varchar(6),
- color varchar(6)
+ color varchar(6),
+ accountancy_code varchar(24) NULL
)ENGINE=innodb;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 1646c7f271e..90c7489089e 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -313,7 +313,7 @@ LanguageFilesCachedIntoShmopSharedMemory=Files .lang loaded in shared memory
ExamplesWithCurrentSetup=Examples with current running setup
ListOfDirectories=List of OpenDocument templates directories
ListOfDirectoriesForModelGenODT=List of directories containing templates files with OpenDocument format.
Put here full path of directories. Add a carriage return between eah directory. To add a directory of the GED module, add here DOL_DATA_ROOT/ecm/yourdirectoryname.
Files in those directories must end with .odt.
-NumberOfModelFilesFound=Number of ODT templates files found in those directories
+NumberOfModelFilesFound=Number of ODT/ODS templates files found in those directories
ExampleOfDirectoriesForModelGen=Examples of syntax: c:\mydir /home/mydir DOL_DATA_ROOT/ecm/ecmdir
FollowingSubstitutionKeysCanBeUsed= To know how to create your odt document templates, before storing them in those directories, read wiki documentation:
FullListOnOnlineDocumentation=http://wiki.dolibarr.org/index.php/Create_an_ODT_document_template
@@ -1002,7 +1002,7 @@ ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The cod
UseNotifications=Use notifications
NotificationsDesc=EMails notifications feature allows you to silently send automatic mail, for some Dolibarr events, to third parties (customers or suppliers) that are configured to. Choice of active notification and targets contacts is made one third party at time.
ModelModules=Documents templates
-DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for OpenOffice, KOffice, TextEdit,...)
+DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT or .ODS files for OpenOffice, KOffice, TextEdit,...)
WatermarkOnDraft=Watermark on draft document
CompanyIdProfChecker=Rules on Professional Ids
MustBeUnique=Must be unique ?
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index a7dacc49a74..8c4624fb057 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -106,4 +106,5 @@ TypeContact_project_task_external_CONTRIBUTOR=Contributor
# Documents models
DocumentModelBaleine=A complete project's report model (logo...)
PlannedWorkload = Planned workload
-WorkloadOccupation= Workload affectation
\ No newline at end of file
+WorkloadOccupation= Workload affectation
+ProjectReferers=Refering objects
diff --git a/htdocs/langs/es_ES/categories.lang b/htdocs/langs/es_ES/categories.lang
index 217eb80ae64..65c55bced65 100644
--- a/htdocs/langs/es_ES/categories.lang
+++ b/htdocs/langs/es_ES/categories.lang
@@ -42,7 +42,7 @@ ErrCatAlreadyExists=Este nombre esta siendo utilizado
AddProductToCat=¿Añadir este producto a una categoría?
ImpossibleAddCat=Imposible añadir la categoría
ImpossibleAssociateCategory=Imposible asociar la categoría
-WasAddedSuccessfully=se ha añadido con éxito.
+WasAddedSuccessfully=La categoría se ha añadido con éxito.
ObjectAlreadyLinkedToCategory=El elemento ya está enlazado a esta categoría
CategorySuccessfullyCreated=La categoría %s se insertado correctamente.
ProductIsInCategories=Este producto/servicio se encuentra en las siguientes categorías
@@ -97,4 +97,4 @@ CatMemberList=Listado categorías de miembros
CatSupLinks=Proveedores
CatCusLinks=Clientes/Clientes potenciales
CatProdLinks=Productos
-CatMemberLinks=Miembros
\ No newline at end of file
+CatMemberLinks=Miembros
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index ef98c76c657..f3b134eec83 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -314,7 +314,7 @@ LanguageFilesCachedIntoShmopSharedMemory=Fichiers .lang en mémoire partagée
ExamplesWithCurrentSetup=Exemples avec le paramétrage actif courant
ListOfDirectories=Liste des répertoires des modèles OpenDocument
ListOfDirectoriesForModelGenODT=Liste des répertoires contenant des documents modèles OpenDocument.
Indiquer les chemins complets de répertoire. Ajouter un retour à la ligne entre chaque répertoire. Pour indiquer un répertoire du module GED, indiquer DOL_DATA_ROOT/ecm/nomdurepertoireged
Les fichiers modèles dans ces répertoires doivent se terminer par .odt.
-NumberOfModelFilesFound=Nombre de fichiers modèles ODT trouvés dans ce(s) répertoire(s)
+NumberOfModelFilesFound=Nombre de fichiers modèles ODT/ODS trouvés dans ce(s) répertoire(s)
ExampleOfDirectoriesForModelGen=Exemple de syntaxe : c:\\mydir /home/mydir DOL_DATA_ROOT/ecm/ecmdir
FollowingSubstitutionKeysCanBeUsed= Pour savoir comment rédiger des modèles de document odt avant de les placer dans un de ces répertoires, consulter la documentation du wiki :
FullListOnOnlineDocumentation=http://wiki.dolibarr.org/index.php/Créer_un_modèle_de_document_ODT
@@ -1004,7 +1004,7 @@ ModuleCompanyCodeDigitaria=Renvoie un code comptable composé suivant le code ti
UseNotifications=Utiliser les notifications
NotificationsDesc=La fonction des notifications par emails permet d'envoyer automatiquement un email, pour certains événements Dolibarr, aux tiers (sociétés clients, prospects ou fournisseurs) configurés pour. Le choix des notifications et contacts destinataires se fait tiers par tiers.
ModelModules=Modèle de documents
-DocumentModelOdt=Génération depuis des modèles OpenDocument (Fichier .ODT OpenOffice, KOffice, TextEdit…)
+DocumentModelOdt=Génération depuis des modèles OpenDocument (Fichier .ODT ou .ODS OpenOffice, KOffice, TextEdit…)
WatermarkOnDraft=Filigrane sur les documents brouillons
CompanyIdProfChecker=Règles sur les Identifiants professionnels
MustBeUnique=Doit être unique ?
diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang
index a38efe47d22..6cec42521be 100644
--- a/htdocs/langs/fr_FR/projects.lang
+++ b/htdocs/langs/fr_FR/projects.lang
@@ -108,4 +108,5 @@ DocumentModelBaleine=Modèle de rapport de projet complet (logo...)
SelectElement=Eléments associable au projet :
AddElement=Associer
PlannedWorkload = Charge de travail prévue
-WorkloadOccupation= Pourcentage affectation
\ No newline at end of file
+WorkloadOccupation= Pourcentage affectation
+ProjectReferers=Objets associés
diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php
index c55574d363a..0871aaf71e0 100644
--- a/htdocs/paybox/admin/paybox.php
+++ b/htdocs/paybox/admin/paybox.php
@@ -61,8 +61,8 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",GETPOST('PAYBOX_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
- $result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
- if (! $result > 0) $error++;
+ $result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
+ if (! $result > 0) $error++;
if (! $error)
{
@@ -93,12 +93,12 @@ llxHeader();
$linkback=''.$langs->trans("BackToModuleList").'';
print_fiche_titre($langs->trans("PayBoxSetup"),$linkback,'setup');
-$h = 0;
-$head = array();
-
-$head[$h][0] = DOL_URL_ROOT."/paybox/admin/paybox.php";
-$head[$h][1] = $langs->trans("Account");
-$head[$h][2] = 'payboxaccount';
+$h = 0;
+$head = array();
+
+$head[$h][0] = DOL_URL_ROOT."/paybox/admin/paybox.php";
+$head[$h][1] = $langs->trans("Account");
+$head[$h][2] = 'payboxaccount';
$h++;
dol_fiche_head($head, 'payboxaccount', '');
@@ -198,17 +198,17 @@ $doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,''
$doleditor->Create();
print '';
-$var=!$var;
-print '