';
print ' | ';
- print '% | ';
+ print ' | ';
print ' | ';
print ' | ';
print ' | ';
- print '% | ';
+ print '% | ';
print ' | ';
print ' | ';
print '';
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index cdba648cac9..17033845f8c 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
$langs->load("errors");
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 250a155ad57..d3aa3557c89 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -484,24 +484,24 @@ if ($object->fetch($id) >= 0)
if ($obj->source_type == 'member')
{
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $m=new Adherent($db);
- $m->fetch($obj->source_id);
- print $m->getNomUrl(2);
+ $objectstatic=new Adherent($db);
+ $objectstatic->fetch($obj->source_id);
+ print $objectstatic->getNomUrl(2);
}
else if ($obj->source_type == 'user')
{
include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
- $m=new User($db);
- $m->fetch($obj->source_id);
- $m->id=$obj->source_id;
- print $m->getNomUrl(2);
+ $objectstatic=new User($db);
+ $objectstatic->fetch($obj->source_id);
+ $objectstatic->id=$obj->source_id;
+ print $objectstatic->getNomUrl(2);
}
else if ($obj->source_type == 'thirdparty')
{
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
- $m=new Societe($db);
- $m->fetch($obj->source_id);
- print $m->getNomUrl(2);
+ $objectstatic=new Societe($db);
+ $objectstatic->fetch($obj->source_id);
+ print $objectstatic->getNomUrl(2);
}
else
{
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index ec03e023e7a..8e5e73fd6fc 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -422,6 +422,7 @@ if ($resql)
$notshippable=0;
$warning = 0;
$text_info='';
+ $text_warning='';
$nbprod=0;
$numlines = count($generic_commande->lines); // Loop on each line of order
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index 4d9b6bb53f5..79f18ad26ab 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -300,7 +300,8 @@ if (($action == 'create' || $action == 'add') && !$error)
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
- $lines[$i]->pa_ht
+ $lines[$i]->pa_ht,
+ $lines[$i]->label
);
if ($result > 0)
{
@@ -396,9 +397,9 @@ if ($action == 'create' && !$error)
print '';
print '';
print '';
-
+
dol_fiche_head();
-
+
print '\n";
-
-
+
+
}
// Mode liste
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 08ab509448a..cccf16f0467 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
$langs->load("banks");
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index a1a1d1cc69a..37ec345295b 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -6,7 +6,7 @@
* Copyright (C) 2010-2015 Juanjo Menent
* Copyright (C) 2013 Christophe Battarel
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2014 Ferran Marcet
+ * Copyright (C) 2014-2016 Ferran Marcet
* Copyright (C) 2014 Marcos García
* Copyright (C) 2015 Jean-François Ferry
*
@@ -1718,9 +1718,11 @@ else
{
$tmpaction='activateline';
if ($objp->statut == 4) $tmpaction='unactivateline';
- print 'id.'&ligne='.$object->lines[$cursorline-1]->id.'&action='.$tmpaction.'">';
- print img_edit();
- print '';
+ if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->unactiver)) {
+ print 'id . '&ligne=' . $object->lines[$cursorline - 1]->id . '&action=' . $tmpaction . '">';
+ print img_edit();
+ print '';
+ }
}
}
print ' | ';
diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php
index 2a58876cdd7..62bcf9d22c5 100644
--- a/htdocs/core/class/link.class.php
+++ b/htdocs/core/class/link.class.php
@@ -275,9 +275,9 @@ class Link extends CommonObject
/**
* Return nb of links
*
- * @param DoliDb $db Database handler
- * @param string $objecttype type of the associated object in dolibarr
- * @param int $objectid id of the associated object in dolibarr
+ * @param DoliDb $db Database handler
+ * @param string $objecttype Type of the associated object in dolibarr
+ * @param int $objectid Id of the associated object in dolibarr
* @return int Nb of links, -1 if error
**/
public static function count($db, $objecttype, $objectid)
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 6263b1b709d..baa73c532f8 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -936,33 +936,92 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$langs->load("accountancy");
- $newmenu->add("/accountancy/customer/index.php?leftmenu=ventil_customer",$langs->trans("CustomersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_customer');
- if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->dispatch);
- if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
+ $permtoshowmenu=(! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire);
+ $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy",$langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
+
+ // Dispatch
+ $newmenu->add("/accountancy/customer/index.php?leftmenu=dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_customer');
+ if (empty($leftmenu) || $leftmenu=="dispatch_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
+ if (empty($leftmenu) || $leftmenu=="dispatch_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
if (! empty($conf->supplier_invoice->enabled))
{
- $newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier');
- if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->dispatch);
- if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
+ $newmenu->add("/accountancy/supplier/index.php?leftmenu=dispatch_supplier&mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_supplier');
+ if (empty($leftmenu) || $leftmenu=="dispatch_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
+ if (empty($leftmenu) || $leftmenu=="dispatch_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
}
+
+ // Journals
+ if(! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy')
+ {
+ $newmenu->add('',$langs->trans("Journaux"),1,$user->rights->accounting->comptarapport->lire);
+
+ $sql = "SELECT rowid, label, accountancy_journal";
+ $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
+ $sql.= " WHERE entity = ".$conf->entity;
+ $sql.= " AND clos = 0";
+ $sql.= " ORDER BY label";
+
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $numr = $db->num_rows($resql);
+ $i = 0;
+
+ if ($numr > 0)
+ while ($i < $numr)
+ {
+ $objp = $db->fetch_object($resql);
+ $newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,2,$user->rights->accounting->comptarapport->lire);
+ $i++;
+ }
+ }
+ else dol_print_error($db);
+ $db->free($resql);
+
+ // Add other journal
+ $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),2,$user->rights->accounting->comptarapport->lire);
+ $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),2,$user->rights->accounting->comptarapport->lire);
+ }
+
+ // General Ledger
+ $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping');
+ if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),2,$user->rights->accounting->mouvements->lire);
+ if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),2,$user->rights->accounting->mouvements->lire);
+
+ // Reports
+ $langs->load("compta");
+
+ $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
+
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
+
+ // Admin
+ $langs->load("admin");
+ $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
+ $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount');
}
- // Rapports
- if (! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled))
+ // Comptabilite
+ if (! empty($conf->comptabilite->enabled))
{
$langs->load("compta");
// Bilan, resultats
- $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy",$langs->trans("Reportings"),0,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
+ $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy",$langs->trans("Reportings"),0,$user->rights->compta->resultat->lire, '', $mainmenu, 'ca');
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=report",$langs->trans("ReportInOut"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=report",$langs->trans("ReportInOut"),1,$user->rights->compta->resultat->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire);
/* On verra ca avec module compabilite expert
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire);
*/
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=report",$langs->trans("ReportTurnover"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=report",$langs->trans("ReportTurnover"),1,$user->rights->compta->resultat->lire);
/*
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire);
@@ -971,74 +1030,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire);
}
*/
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),2,$user->rights->compta->resultat->lire);
- if (! empty($conf->comptabilite->enabled))
- {
- // Journaux
- //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
- //journaux
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire);
- if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire);
- }
-
- // Report expert
- if (! empty($conf->accounting->enabled))
- {
- $langs->load("accountancy");
-
- // Grand livre
- $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping');
- if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire);
- if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire);
-
- // Accountancy journals
- if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy')
- {
- $newmenu->add('/accountancy/journal/index.php?leftmenu=journal',$langs->trans("Journaux"),0,$user->rights->banque->lire);
-
- if ($leftmenu == 'journal')
- {
- $sql = "SELECT rowid, label, accountancy_journal";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
- $sql.= " WHERE entity = ".$conf->entity;
- $sql.= " AND clos = 0";
- $sql.= " ORDER BY label";
-
- $resql = $db->query($sql);
- if ($resql)
- {
- $numr = $db->num_rows($resql);
- $i = 0;
-
- if ($numr > 0)
-
- while ($i < $numr)
- {
- $objp = $db->fetch_object($resql);
- $newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,1,$user->rights->accounting->comptarapport->lire);
- $i++;
- }
- }
- else dol_print_error($db);
- $db->free($resql);
-
- // Add other journal
- $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire);
- $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire);
- }
- }
- }
- }
-
- // Setup
- if (! empty($conf->accounting->enabled))
- {
- $langs->load("admin");
- // $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
- $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount');
+ // Journaux
+ //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire);
+ if (empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire);
}
}
diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php
index b185e2962f2..1aa5008032d 100644
--- a/htdocs/core/modules/modECM.class.php
+++ b/htdocs/core/modules/modECM.class.php
@@ -175,7 +175,7 @@ class modECM extends DolibarrModules
'langs'=>'ecm',
'position'=>103,
'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
- 'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
+ 'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && ! empty($conf->global->ECM_AUTO_TREE_ENABLED)',
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 295e348dc98..7616e6a36dd 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -44,7 +44,7 @@ class modProduct extends DolibarrModules
*/
function __construct($db)
{
- global $conf;
+ global $conf, $mysoc;
$this->db = $db;
$this->numero = 50;
@@ -148,55 +148,20 @@ class modProduct extends DolibarrModules
$this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("produit","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
+ if ($mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.pmp'=>'PMPValue'));
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices'));
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
- if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.pmp'=>'Numeric'));
+ if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.pmp'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric'));
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product");
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product'));
- // Add extra fields
- $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.')';
- $resql=$this->db->query($sql);
- if ($resql) // This can fail when class is used on old database (during migration for example)
- {
- while ($obj=$this->db->fetch_object($resql))
- {
- $fieldname='extra.'.$obj->name;
- $fieldlabel=ucfirst($obj->label);
- $typeFilter="Text";
- switch($obj->type)
- {
- case 'int':
- case 'double':
- case 'price':
- $typeFilter="Numeric";
- break;
- case 'date':
- case 'datetime':
- $typeFilter="Date";
- break;
- case 'boolean':
- $typeFilter="Boolean";
- break;
- case 'sellist':
- $tmp='';
- $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
- if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options']));
- if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
- break;
- }
- $this->export_fields_array[$r][$fieldname]=$fieldlabel;
- $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
- $this->export_entities_array[$r][$fieldname]='product';
- }
- }
- // End add extra fields
-
+ $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
@@ -216,12 +181,14 @@ class modProduct extends DolibarrModules
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation');
+ if ($mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
//$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product",
'pr.price_ttc'=>"product",
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
+ 'pr.recuperableonly'=>'product',
'pr.date_price'=>"product");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
@@ -244,6 +211,7 @@ class modProduct extends DolibarrModules
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*');
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
+ if ($mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR'));
// Add extra fields
$import_extrafield_sample=array();
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.')';
@@ -260,8 +228,8 @@ class modProduct extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
- $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
- $import_sample=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31');
+ $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','p.recuperableonly'=>'^[0|1]$');
+ $import_sample=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1');
$this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample);
if (! empty($conf->fournisseur->enabled))
@@ -309,12 +277,14 @@ class modProduct extends DolibarrModules
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation*');
- $this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
+ if ($mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR'));
+ $this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
'pr.price'=>"100",'pr.price_ttc'=>"110",
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
- 'pr.tva_tx'=>'19.6',
+ 'pr.tva_tx'=>'20',
+ 'pr.recuperableonly'=>'0',
'pr.date_price'=>'2013-04-10');
}
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index ff16d70ed33..4d1764ad0cf 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -30,6 +30,7 @@ $langs->load("sendings");
$langs->load("deliveries");
$langs->load('companies');
+$socid=GETPOST('socid','int');
// Security check
$expeditionid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 7de87b8bb47..2a281bda595 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -370,7 +370,7 @@ class ExpenseReport extends CommonObject
function set_paid($id, $fuser)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."expensereport";
- $sql.= " SET fk_statut = 6";
+ $sql.= " SET fk_statut = 6, paid=1";
$sql.= " WHERE rowid = ".$id." AND fk_statut = 5";
dol_syslog(get_class($this)."::set_paid sql=".$sql, LOG_DEBUG);
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 9e729fb36ac..c6fe3094b68 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -836,6 +836,7 @@ if ($step == 4 && $datatoimport)
print '';
// List of targets fields
+ $height=24;
$i = 0;
$var=true;
$mandatoryfieldshavesource=true;
@@ -843,7 +844,7 @@ if ($step == 4 && $datatoimport)
foreach($fieldstarget as $code=>$label)
{
$var=!$var;
- print ' |