';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 0ddb1618f34..20f325658f6 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -46,7 +46,7 @@ class Contrat extends CommonObject
var $id;
var $ref;
var $ref_ext;
- var $ref_customer;
+ var $ref_supplier;
var $socid;
var $societe; // Objet societe
var $statut=0; // 0=Draft,
@@ -403,7 +403,7 @@ class Contrat extends CommonObject
$sql.= " fk_projet,";
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
$sql.= " note_private, note_public, model_pdf, extraparams";
- $sql.= " ,ref_customer";
+ $sql.= " ,ref_supplier";
$sql.= " ,ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
if ($ref)
@@ -423,7 +423,7 @@ class Contrat extends CommonObject
{
$this->id = $result["rowid"];
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"];
- $this->ref_customer = $result["ref_customer"];
+ $this->ref_supplier = $result["ref_supplier"];
$this->ref_ext = $result["ref_ext"];
$this->statut = $result["statut"];
$this->mise_en_service = $this->db->jdate($result["datemise"]);
@@ -726,7 +726,7 @@ class Contrat extends CommonObject
// Insert contract
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
- $sql.= " ref, entity, note_private, note_public, ref_customer, ref_ext)";
+ $sql.= " ref, entity, note_private, note_public, ref_supplier, ref_ext)";
$sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
$sql.= ", '".$this->db->idate($this->date_contrat)."'";
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
@@ -736,7 +736,7 @@ class Contrat extends CommonObject
$sql.= ", ".$conf->entity;
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
- $sql.= ", ".(!empty($this->ref_customer)?("'".$this->db->escape($this->ref_customer)."'"):"NULL");
+ $sql.= ", ".(!empty($this->ref_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
$sql.= ")";
$resql=$this->db->query($sql);
@@ -988,7 +988,7 @@ class Contrat extends CommonObject
// Clean parameters
if (isset($this->ref)) $this->ref=trim($this->ref);
- if (isset($this->ref_customer)) $this->ref_customer=trim($this->ref_customer);
+ if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext);
if (isset($this->entity)) $this->entity=trim($this->entity);
if (isset($this->statut)) $this->statut=trim($this->statut);
@@ -1012,7 +1012,7 @@ class Contrat extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET";
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
- $sql.= " ref_customer=".(isset($this->ref_customer)?"'".$this->db->escape($this->ref_customer)."'":"null").",";
+ $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").",";
$sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").",";
$sql.= " entity=".$conf->entity.",";
$sql.= " date_contrat=".(dol_strlen($this->date_contrat)!=0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').",";
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 7970e80603c..5f9c2099107 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -42,7 +42,7 @@ $offset = $limit * $page ;
$search_nom=GETPOST('search_nom');
$search_contract=GETPOST('search_contract');
-$search_ref_customer=GETPOST('search_ref_customer','alpha');
+$search_ref_supplier=GETPOST('search_ref_supplier','alpha');
$sall=GETPOST('sall');
$statut=GETPOST('statut')?GETPOST('statut'):1;
$socid=GETPOST('socid');
@@ -75,7 +75,7 @@ $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND
$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,";
$sql.= " s.nom, s.rowid as socid";
-$sql.= " ,c.ref_customer";
+$sql.= " ,c.ref_supplier";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
@@ -90,8 +90,8 @@ if ($search_nom) {
if ($search_contract) {
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
}
-if (!empty($search_ref_customer)) {
- $sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
+if (!empty($search_ref_supplier)) {
+ $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
}
if ($sall) {
$sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
@@ -114,9 +114,9 @@ if ($resql)
print '
';
$param='&search_contract='.$search_contract;
$param.='&search_nom='.$search_nom;
- $param.='&search_ref_customer='.$search_ref_customer;
+ $param.='&search_ref_supplier='.$search_ref_supplier;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
@@ -134,7 +134,7 @@ if ($resql)
print '';
print '';
print '| ';
- print '';
+ print '';
print ' | ';
print '';
print '';
@@ -156,7 +156,7 @@ if ($resql)
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'';
if ($obj->nb_late) print img_warning($langs->trans("Late"));
print ' | ';
- print ''.$obj->ref_customer.' | ';
+ print ''.$obj->ref_supplier.' | ';
print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.' | ';
//print ''.dol_print_date($obj->datec).' | ';
print ''.dol_print_date($db->jdate($obj->date_contrat)).' | ';
diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php
index c402353e8d7..babddd9a2fe 100644
--- a/htdocs/core/class/hookmanager.class.php
+++ b/htdocs/core/class/hookmanager.class.php
@@ -114,8 +114,8 @@ class HookManager
*
* @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
* @param array $parameters Array of parameters
- * @param Object $object Object to use hooks on
- * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
+ * @param Object $object Object to use hooks on
+ * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints.
* Can also return some values into an array ->results.
@@ -144,7 +144,8 @@ class HookManager
'moveUploadedFile',
'pdf_writelinedesc',
'paymentsupplierinvoices',
- 'printSearchForm'
+ 'printSearchForm',
+ 'formatEvent'
)
)) $hooktype='addreplace';
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index c8cccefda7f..87dfcf1367b 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -100,7 +100,7 @@ function dol_hash($chain,$type=0)
* @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
- * @param string $feature2 Feature to check, second level of permission (optional)
+ * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param Canvas $objcanvas Object canvas
@@ -140,7 +140,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
// Check read permission from module
$readok=1; $nbko=0;
- foreach ($featuresarray as $feature)
+ foreach ($featuresarray as $feature) // first we check nb of test ko
{
if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($feature,$listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
{
@@ -174,11 +174,17 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
}
else if (! empty($feature2)) // This should be used for future changes
{
+ $tmpreadok=1;
foreach($feature2 as $subfeature)
{
- if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $readok=0; $nbko++; }
- else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $readok=0; $nbko++; }
- else { $readok=1; break; } // Break is to bypass second test if the first is ok
+ if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok=0; }
+ else if (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok=0; }
+ else { $tmpreadok=1; break; } // Break is to bypass second test if the first is ok
+ }
+ if (! $tmpreadok) // We found a test on feature that is ko
+ {
+ $readok=0; // All tests are ko (we manage here the and, the or will be managed later using $nbko).
+ $nbko++;
}
}
else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index bea92481d12..86e74cfcc5f 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -624,7 +624,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
// Contacts
- $newmenu->add("/contact/list.php?leftmenu=contacts", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts');
+ $newmenu->add("/societe/index.php?leftmenu=thirdparties", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ThirdParty") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts');
$newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer);
$newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire);
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire);
@@ -790,6 +790,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
// if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
}
+
+ // Supplier Orders
+ if (! empty($conf->fournisseur->enabled))
+ {
+ $langs->load("supplier");
+ $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
+ // if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
+ }
+
// Donations
if (! empty($conf->don->enabled))
diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php
index bab287ff3b6..87923b4cb9c 100644
--- a/htdocs/core/modules/export/export_excel.modules.php
+++ b/htdocs/core/modules/export/export_excel.modules.php
@@ -190,6 +190,14 @@ class ExportExcel extends ModeleExports
return -1;
}
}
+
+ if (!empty($conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR)) {
+ $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM;
+ $cacheSettings = array (
+ 'dir' => $conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR
+ );
+ PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+ }
$this->workbook = new PHPExcel();
$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION);
diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
index bb9f1d155ff..76c082fa70d 100644
--- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
+++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
@@ -100,8 +100,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->posxcomm=112;
//$this->posxtva=112;
//$this->posxup=126;
- $this->posxqty=174;
- $this->posxremainingqty=165;
+ $this->posxqty=165;
+ $this->posxremainingqty=185;
//$this->posxdiscount=162;
//$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 5a2053f85ff..a23fc59a2d0 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -198,7 +198,7 @@ class modProduct extends DolibarrModules
$this->export_entities_array[$r][$fieldname]='product';
}
}
- // End add axtra fields
+ // End add extra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
@@ -210,15 +210,14 @@ class modProduct extends DolibarrModules
{
// Exports product multiprice
$r++;
- //$this->export_code[$r]=$this->rights_class.'_'.$key; // FIXME $key is not defined
- $this->export_code[$r]=$this->rights_class;
+ $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]="ProductsMultiPrice"; // 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",
- 'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
- 'pr.price'=>"HT",'pr.price_ttc'=>"TTC",
- 'pr.price_min'=>"MinPriceHT",'pr.price_min_ttc'=>"MinPriceTTC",
- 'pr.tva_tx'=>'VATRate',
+ 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
+ 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
+ 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
+ 'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation');
//$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'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
@@ -305,11 +304,11 @@ class modProduct extends DolibarrModules
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price');
$this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id
- $this->import_fields_array[$r]=array('pr.fk_product'=>"Id*",
- 'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
- 'pr.price'=>"HT",'pr.price_ttc'=>"TTC",
- 'pr.price_min'=>"MinPriceHT",'pr.price_min_ttc'=>"MinPriceTTC",
- 'pr.tva_tx'=>'VATRate',
+ $this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*",
+ 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel",
+ 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
+ '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]$');
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
@@ -333,7 +332,6 @@ class modProduct extends DolibarrModules
*/
function init($options='')
{
- // Permissions
$this->remove($options);
$sql = array();
diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php
index 363fcaf6467..839d50709c7 100644
--- a/htdocs/core/modules/modService.class.php
+++ b/htdocs/core/modules/modService.class.php
@@ -60,7 +60,7 @@ class modService extends DolibarrModules
$this->picto='service';
// Data directories to create when module is enabled
- $this->dirs = array("/produit/temp");
+ $this->dirs = array("/product/temp");
// Dependancies
$this->depends = array();
@@ -147,7 +147,7 @@ class modService extends DolibarrModules
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'service'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'service'));
// Add extra fields
- $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
+ $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
@@ -155,8 +155,28 @@ class modService extends DolibarrModules
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
- $this->export_fields_array[$r][$fieldname]=$fieldlabel;
- $this->export_entities_array[$r][$fieldname]='product';
+ $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':
+ $typeFilter="List:".$obj->param;
+ 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
@@ -164,7 +184,8 @@ class modService extends DolibarrModules
$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';
- $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity("product", 1).')';
+ if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
+ $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity("product", 1).')';
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
@@ -186,7 +207,7 @@ class modService extends DolibarrModules
$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'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
+ 'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.date_price'=>"product");
$this->export_sql_start[$r]='SELECT DISTINCT ';
@@ -208,10 +229,10 @@ class modService extends DolibarrModules
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
$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.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*');
+ $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'));
// Add extra fields
- $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
+ $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity = ".$conf->entity;
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
@@ -225,7 +246,7 @@ class modService 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]$');
- $this->import_examplevalues_array[$r]=array('p.ref'=>"PR123456",'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_examplevalues_array[$r]=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');
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
@@ -297,7 +318,6 @@ class modService extends DolibarrModules
*/
function init($options='')
{
- // Permissions et valeurs par defaut
$this->remove($options);
$sql = array();
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index dd50e24c8e6..c4f9ff2b206 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -47,6 +47,8 @@ $(document).ready(function () {
+