Browse Source

Merge branch 'cat_extrafields' of https://github.com/aternatik/dolibarr
into aternatik-cat_extrafields

Conflicts:
htdocs/install/mysql/migration/3.5.0-3.6.0.sql

Laurent Destailleur 11 years ago
parent
commit
7974ae96ad

+ 2 - 2
htdocs/categories/admin/categorie.php

@@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
 if (!$user->admin)
 accessforbidden();
 
-$langs->load("cateogries");
+$langs->load("categories");
 
 $action=GETPOST("action");
 
@@ -95,7 +95,7 @@ $form = new Form($db);
 $var=!$var;
 print '<tr '.$bc[$var].'>';
 print '<td>'.$langs->trans("CategorieRecursiv").'</td>';
-print '<td align="center" width="20">&nbsp;</td>';
+print '<td align="center" width="20">'. $form->textwithpicto('',$langs->trans("CategorieRecursivHelp"),1,'help').'</td>';
 
 print '<td align="center" width="100">';
 if ($conf->use_javascript_ajax)

+ 151 - 0
htdocs/categories/admin/categorie_extrafields.php

@@ -0,0 +1,151 @@
+<?php
+/* Copyright (C) 2001-2002	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
+ * Copyright (C) 2003		Jean-Louis Bergamo		<jlb@j1b.org>
+ * Copyright (C) 2004-2012	Laurent Destailleur		<eldy@users.sourceforge.net>
+ * Copyright (C) 2012		Regis Houssin			<regis.houssin@capnetworks.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ *      \file       htdocs/categories/admin/categorie_extrafields.php
+ *		\ingroup    societe
+ *		\brief      Page to setup extra fields of category
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+
+$langs->load("categories");
+$langs->load("admin");
+
+$extrafields = new ExtraFields($db);
+$form = new Form($db);
+
+// List of supported format
+$tmptype2label=getStaticMember(get_class($extrafields),'type2label');
+$type2label=array('');
+foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
+
+$action=GETPOST('action', 'alpha');
+$attrname=GETPOST('attrname', 'alpha');
+$elementtype='categories'; //Must be the $element of the class that manage extrafield
+
+if (!$user->admin) accessforbidden();
+
+
+/*
+ * Actions
+ */
+require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
+
+
+/*
+ * View
+ */
+
+$textobject=$langs->transnoentitiesnoconv("Categories");
+
+$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
+llxHeader('',$langs->trans("CompanySetup"),$help_url);
+
+
+$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
+print_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'setup');
+
+$head = categoriesadmin_prepare_head(null);
+
+dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'categoriesadmin');
+
+print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
+print '<br>';
+
+// Load attribute_label
+$extrafields->fetch_name_optionals_label($elementtype);
+
+print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
+
+print '<tr class="liste_titre">';
+print '<td>'.$langs->trans("Label").'</td>';
+print '<td>'.$langs->trans("AttributeCode").'</td>';
+print '<td>'.$langs->trans("Type").'</td>';
+print '<td align="right">'.$langs->trans("Size").'</td>';
+print '<td align="center">'.$langs->trans("Unique").'</td>';
+print '<td align="center">'.$langs->trans("Required").'</td>';
+print '<td width="80">&nbsp;</td>';
+print "</tr>\n";
+
+$var=True;
+foreach($extrafields->attribute_type as $key => $value)
+{
+    $var=!$var;
+    print "<tr ".$bc[$var].">";
+    print "<td>".$extrafields->attribute_label[$key]."</td>\n";
+    print "<td>".$key."</td>\n";
+    print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
+    print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
+    print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
+    print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
+    print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
+    print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
+    print "</tr>";
+    //      $i++;
+}
+
+print "</table>";
+
+dol_fiche_end();
+
+
+// Buttons
+if ($action != 'create' && $action != 'edit')
+{
+    print '<div class="tabsAction">';
+    print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
+    print "</div>";
+}
+
+
+/* ************************************************************************** */
+/*                                                                            */
+/* Creation d'un champ optionnel
+ /*                                                                            */
+/* ************************************************************************** */
+
+if ($action == 'create')
+{
+    print "<br>";
+    print_titre($langs->trans('NewAttribute'));
+
+    require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
+}
+
+/* ************************************************************************** */
+/*                                                                            */
+/* Edition d'un champ optionnel                                               */
+/*                                                                            */
+/* ************************************************************************** */
+if ($action == 'edit' && ! empty($attrname))
+{
+    print "<br>";
+    print_titre($langs->trans("FieldEdition", $attrname));
+
+    require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
+}
+
+llxFooter();
+
+$db->close();
+?>

+ 58 - 4
htdocs/categories/class/categorie.class.php

@@ -28,6 +28,7 @@
  *	\brief      File of class to manage categories
  */
 
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
@@ -36,10 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
 /**
  *	Class to manage categories
  */
-class Categorie
+class Categorie extends CommonObject
 {
 	public $element='category';
-	public $table_element='category';
+	public $table_element='categories';
 
 	var $id;
 	var $fk_parent;
@@ -102,6 +103,8 @@ class Categorie
 				$this->visible		= $res['visible'];
 				$this->type			= $res['type'];
 				$this->entity		= $res['entity'];
+				
+				$this->fetch_optionals($this->id,$extralabels);
 
 				$this->db->free($resql);
 
@@ -130,7 +133,7 @@ class Categorie
 	 */
 	function create($user='')
 	{
-		global $conf,$langs;
+		global $conf,$langs,$hookmanager;
 		$langs->load('categories');
 
 		$error=0;
@@ -188,6 +191,24 @@ class Categorie
 			if ($id > 0)
 			{
 				$this->id = $id;
+				
+				// Actions on extra fields (by external module or standard code)
+				// FIXME le hook fait double emploi avec le trigger !!
+				$hookmanager->initHooks(array('HookModuleNamedao'));
+				$parameters=array('socid'=>$this->id);
+				$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
+				if (empty($reshook))
+				{
+					if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
+					{
+						$result=$this->insertExtraFields();
+						if ($result < 0)
+						{
+							$error++;
+						}
+					}
+				}
+				else if ($reshook < 0) $error++;
 
 				// Appel des triggers
 				include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@@ -224,7 +245,7 @@ class Categorie
 	 */
 	function update($user='')
 	{
-		global $conf, $langs;
+		global $conf, $langs,$hookmanager;
 
 		$error=0;
 
@@ -257,8 +278,28 @@ class Categorie
 		dol_syslog(get_class($this)."::update sql=".$sql);
 		if ($this->db->query($sql))
 		{
+			
+			// Actions on extra fields (by external module or standard code)
+			// FIXME le hook fait double emploi avec le trigger !!
+			$hookmanager->initHooks(array('HookCategorydao'));
+			$parameters=array();
+			$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
+			if (empty($reshook))
+			{
+				if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
+				{
+					$result=$this->insertExtraFields();
+					if ($result < 0)
+					{
+						$error++;
+					}
+				}
+			}
+			else if ($reshook < 0) $error++;
+			
 			$this->db->commit();
 
+			
 			// Appel des triggers
 			include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
 			$interface=new Interfaces($this->db);
@@ -361,6 +402,19 @@ class Categorie
 			}
 			else
 			{
+				// Removed extrafields
+				if (! $error)
+				{
+					if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
+					{
+						$result=$this->deleteExtraFields();
+						if ($result < 0)
+						{
+							$error++;
+							dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
+						}
+					}
+				}
 				// Appel des triggers
 				include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
 				$interface=new Interfaces($this->db);

+ 12 - 1
htdocs/categories/edit.php

@@ -26,6 +26,7 @@
 
 require '../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
 
 $langs->load("categories");
 
@@ -50,7 +51,10 @@ if ($id == "")
 // Security check
 $result = restrictedArea($user, 'categorie', $id, '&category');
 
+$object = new Categorie($db);
 
+$extrafields = new ExtraFields($db);
+$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
 /*
  * Actions
@@ -85,6 +89,8 @@ if ($action == 'update' && $user->rights->categorie->creer)
 	}
 	if (empty($categorie->error))
 	{
+		$ret = $extrafields->setOptionalsFromPost($extralabels,$categorie);
+		
 		if ($categorie->update($user) > 0)
 		{
 			header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$categorie->id.'&type='.$type);
@@ -115,7 +121,6 @@ print_fiche_titre($langs->trans("ModifCat"));
 dol_htmloutput_errors($mesg);
 
 
-$object = new Categorie($db);
 $object->fetch($id);
 
 $form = new Form($db);
@@ -153,6 +158,12 @@ print '<tr><td>'.$langs->trans("In").'</td><td>';
 print $form->select_all_categories($type,$object->fk_parent,'parent',64,$object->id);
 print '</td></tr>';
 
+$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
+if (empty($reshook) && ! empty($extrafields->attribute_label))
+{
+	print $object->showOptionals($extrafields,'edit');
+}
+
 print '</table>';
 print '<br>';
 

+ 13 - 1
htdocs/categories/fiche.php

@@ -27,9 +27,12 @@
 
 require '../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
 
 $langs->load("categories");
 
+$extrafields = new ExtraFields($db);
+$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
 // Security check
 $socid=GETPOST('socid','int');
@@ -59,6 +62,7 @@ if ($origin)
 
 if ($catorigin && $type == 0) $idCatOrigin = $catorigin;
 
+$object = new Categorie($db);
 
 /*
  *	Actions
@@ -112,7 +116,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
 		}
 	}
 
-	$object = new Categorie($db);
+	
 
 	$object->label			= $label;
 	$object->description	= dol_htmlcleanlastbr($description);
@@ -121,6 +125,8 @@ if ($action == 'add' && $user->rights->categorie->creer)
 	$object->type			= $type;
 
 	if ($parent != "-1") $object->fk_parent = $parent;
+	
+	$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
 
 	if (! $object->label)
 	{
@@ -238,6 +244,12 @@ if ($user->rights->categorie->creer)
 		print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
 		print $form->select_all_categories($type, $catorigin);
 		print '</td></tr>';
+		
+		$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
+		if (empty($reshook))
+		{
+			print $object->showOptionals($extrafields,'edit');
+		}
 
 		print '</table>';
 

+ 11 - 0
htdocs/categories/viewcat.php

@@ -27,6 +27,8 @@
 require '../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+
 
 $langs->load("categories");
 
@@ -49,6 +51,7 @@ $result = restrictedArea($user, 'categorie', $id, '&category');
 
 $object = new Categorie($db);
 $result=$object->fetch($id);
+$object->fetch_optionals($id,$extralabels);
 if ($result <= 0)
 {
 	dol_print_error($db,$object->error);
@@ -57,6 +60,8 @@ if ($result <= 0)
 
 $type=$object->type;
 
+$extrafields = new ExtraFields($db);
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
 
 /*
  *	Actions
@@ -166,6 +171,12 @@ print $langs->trans("Description").'</td><td>';
 print nl2br($object->description);
 print '</td></tr>';
 
+$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
+if (empty($reshook) && ! empty($extrafields->attribute_label))
+{
+	print $object->showOptionals($extrafields);
+}
+
 print '</table>';
 
 print '</div>';

+ 5 - 0
htdocs/core/lib/categories.lib.php

@@ -78,6 +78,11 @@ function categoriesadmin_prepare_head()
 	$head[$h][1] = $langs->trans("Setup");
 	$head[$h][2] = 'setup';
 	$h++;
+	
+	$head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php';
+	$head[$h][1] = $langs->trans("ExtraFieldsCategories");
+	$head[$h][2] = 'attributes_categories';
+	$h++;
 
 	// Show more tabs from modules
 	// Entries must be declared in modules descriptor with line

+ 1 - 1
htdocs/core/modules/modCategorie.class.php

@@ -63,7 +63,7 @@ class modCategorie extends DolibarrModules
 		$this->depends = array();
 
 		// Config pages
-		$this->config_page_url = array();
+		$this->config_page_url = array('categorie_extrafields.php@categories');
 		$this->langfiles = array("products","companies","categories");
 
 		// Constantes

+ 21 - 10
htdocs/install/mysql/migration/3.5.0-3.6.0.sql

@@ -980,18 +980,17 @@ create table llx_product_customer_price
   recuperableonly           integer NOT NULL DEFAULT '0',   -- Other NPR VAT
   localtax1_tx				double(6,3)  DEFAULT 0,         -- Other local VAT 1 
   localtax2_tx				double(6,3)  DEFAULT 0,         -- Other local VAT 2
-  fk_user				integer,
-  import_key			varchar(14)                  -- Import key
+  fk_user				    integer,
+  import_key			    varchar(14)                  -- Import key
 )ENGINE=innodb;
 
 ALTER TABLE llx_product_customer_price ADD INDEX idx_product_customer_price_fk_user (fk_user);
-
-ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_user    FOREIGN KEY (fk_user)    REFERENCES llx_user (rowid);
-
+ALTER TABLE llx_product_customer_price ADD INDEX idx_product_customer_price_fk_soc (fk_soc);
 ALTER TABLE llx_product_customer_price ADD UNIQUE INDEX uk_customer_price_fk_product_fk_soc (fk_product, fk_soc);
 
-ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_customer_price_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product(rowid) ON DELETE CASCADE;
-ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_customer_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid) ON DELETE CASCADE;
+ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
+ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_customer_price_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product(rowid);
+ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_customer_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
 
 ALTER TABLE llx_user ADD COLUMN barcode varchar(255) DEFAULT NULL;
 ALTER TABLE llx_user ADD COLUMN fk_barcode_type integer DEFAULT 0;
@@ -1011,7 +1010,7 @@ create table llx_product_customer_price_log
   price_min_ttc				double(24,8) DEFAULT 0,
   price_base_type			varchar(3)   DEFAULT 'HT',
   tva_tx					double(6,3),
-  recuperableonly           integer NOT NULL DEFAULT '0',   -- Other NPR VAT
+  recuperableonly           integer NOT NULL DEFAULT 0,   -- Other NPR VAT
   localtax1_tx				double(6,3)  DEFAULT 0,         -- Other local VAT 1 
   localtax2_tx				double(6,3)  DEFAULT 0,         -- Other local VAT 2
   fk_user				integer,
@@ -1028,7 +1027,7 @@ CREATE TABLE llx_product_batch (
   eatby datetime DEFAULT NULL,
   sellby datetime DEFAULT NULL,
   batch varchar(30) DEFAULT NULL,
-  qty double NOT NULL DEFAULT '0',
+  qty double NOT NULL DEFAULT 0,
   import_key varchar(14) DEFAULT NULL,
   KEY ix_fk_product_stock (fk_product_stock)
 ) ENGINE=InnoDB;
@@ -1039,7 +1038,7 @@ CREATE TABLE llx_expeditiondet_batch (
   eatby date DEFAULT NULL,
   sellby date DEFAULT NULL,
   batch varchar(30) DEFAULT NULL,
-  qty double NOT NULL DEFAULT '0',
+  qty double NOT NULL DEFAULT 0,
   fk_origin_stock integer NOT NULL,
   KEY ix_fk_expeditiondet (fk_expeditiondet)
 ) ENGINE=InnoDB;
@@ -1069,3 +1068,15 @@ ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32);
 --New 1300 : Add THM on user
 ALTER TABLE llx_user ADD thm double(24,8);
 ALTER TABLE llx_projet_task_time ADD thm double(24,8);
+
+
+-- New : extrafield on categories
+create table llx_categories_extrafields
+(
+  rowid                     integer AUTO_INCREMENT PRIMARY KEY,
+  tms                       timestamp,
+  fk_object                 integer NOT NULL,
+  import_key                varchar(14)                          		-- import key
+) ENGINE=innodb;
+
+ALTER TABLE llx_categories_extrafields ADD INDEX idx_categories_extrafields (fk_object);

+ 20 - 0
htdocs/install/mysql/tables/llx_categories_extrafields.key.sql

@@ -0,0 +1,20 @@
+-- ===================================================================
+-- Copyright (C) 2014 Jean-François Ferry	<jfefe@aternatik.fr>
+--
+-- 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 <http://www.gnu.org/licenses/>.
+--
+-- ===================================================================
+
+
+ALTER TABLE llx_categories_extrafields ADD INDEX idx_categories_extrafields (fk_object);

+ 26 - 0
htdocs/install/mysql/tables/llx_categories_extrafields.sql

@@ -0,0 +1,26 @@
+-- ========================================================================
+-- Copyright (C) 2014 Jean-François Ferry	<jfefe@aternatik.fr>
+--
+-- 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 <http://www.gnu.org/licenses/>.
+--
+-- ========================================================================
+
+create table llx_categories_extrafields
+(
+  rowid                     integer AUTO_INCREMENT PRIMARY KEY,
+  tms                       timestamp,
+  fk_object                 integer NOT NULL,
+  import_key                varchar(14)                          		-- import key
+) ENGINE=innodb;
+

+ 6 - 9
htdocs/install/mysql/tables/llx_product_customer_price.key.sql

@@ -1,8 +1,6 @@
 -- ============================================================================
--- Copyright (C) 2003		Rodolphe Quiedeville	<rodolphe@quiedeville.org>
--- Copyright (C) 2005-2012	Laurent Destailleur		<eldy@users.sourceforge.net>
--- Copyright (C) 2009-2012	Regis Houssin			<regis.houssin@capnetworks.com>
--- Copyright (C) 2013		Florian Henry			<florian.henry@open-concept.pro>
+-- Copyright (C) 2014	Laurent Destailleur		<eldy@users.sourceforge.net>
+-- Copyright (C) 2014	Florian Henry			<florian.henry@open-concept.pro>
 --
 -- 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
@@ -21,10 +19,9 @@
 
 
 ALTER TABLE llx_product_customer_price ADD INDEX idx_product_customer_price_fk_user (fk_user);
-
-ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_user    FOREIGN KEY (fk_user)    REFERENCES llx_user (rowid);
-
+ALTER TABLE llx_product_customer_price ADD INDEX idx_product_customer_price_fk_soc (fk_soc);
 ALTER TABLE llx_product_customer_price ADD UNIQUE INDEX uk_customer_price_fk_product_fk_soc (fk_product, fk_soc);
 
-ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_customer_price_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product(rowid) ON DELETE CASCADE;
-ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_customer_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid) ON DELETE CASCADE;
+ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
+ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product(rowid);
+ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);

+ 6 - 2
htdocs/langs/en_US/categories.lang

@@ -66,7 +66,7 @@ ReturnInCompany=Back to customer/prospect card
 ContentsVisibleByAll=The contents will be visible by all
 ContentsVisibleByAllShort=Contents visible by all
 ContentsNotVisibleByAllShort=Contents not visible by all
-CategoriesTree=Categories tree
+CategoriesTree=Categories tree²
 DeleteCategory=Delete category
 ConfirmDeleteCategory=Are you sure you want to delete this category ?
 RemoveFromCategory=Remove link with categorie
@@ -106,4 +106,8 @@ CatCusLinks=Customer/Prospects
 CatSupLinks=Suppliers
 DeleteFromCat=Remove from category
 DeletePicture=Picture delete
-ConfirmDeletePicture=Confirm picture deletion?
+ConfirmDeletePicture=Confirm picture deletion?
+ExtraFieldsCategories=Complementary attributes
+CategoriesSetup=Categories setup
+CategorieRecursiv=Link with parent category automatically
+CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory