';
@@ -1697,7 +1705,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
if ($fieldlist[$field]=='position') $size='size="4" ';
if ($fieldlist[$field]=='libelle') $size='centpercent';
if ($fieldlist[$field]=='tracking') $class='centpercent';
- if ($fieldlist[$field]=='sortorder') $size='size="2" ';
+ if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '';
print '';
}
diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php
index 1cc55bd5a36..3213503835d 100644
--- a/htdocs/admin/loan.php
+++ b/htdocs/admin/loan.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2014-2016 Alexandre Spangaro
*
* 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
@@ -26,6 +26,7 @@ require '../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
$langs->load("admin");
$langs->load("loan");
@@ -76,6 +77,7 @@ if ($action == 'update')
llxHeader();
$form = new Form($db);
+if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
$linkback=''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup');
@@ -104,7 +106,14 @@ foreach ($list as $key)
// Value
print '
';
if ($modecompta == 'CREANCES-DETTES')
{
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 88cd24af359..259918c5aa9 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -107,6 +107,47 @@ class Contact extends CommonObject
$this->db = $db;
$this->statut = 1; // By default, status is enabled
}
+
+ /**
+ * Load indicators into this->nb for board
+ *
+ * @return int <0 if KO, >0 if OK
+ */
+ function load_state_board()
+ {
+ global $user;
+
+ $this->nb=array();
+ $clause = "WHERE";
+
+ $sql = "SELECT count(sp.rowid) as nb";
+ $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (sp.fk_soc = s.rowid)";
+ if (!$user->rights->societe->client->voir && !$user->societe_id)
+ {
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
+ $sql.= " WHERE sc.fk_user = " .$user->id;
+ $clause = "AND";
+ }
+ $sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')';
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ while ($obj=$this->db->fetch_object($resql))
+ {
+ $this->nb["contacts"]=$obj->nb;
+ }
+ $this->db->free($resql);
+ return 1;
+ }
+ else
+ {
+ dol_print_error($this->db);
+ $this->error=$this->db->lasterror();
+ return -1;
+ }
+ }
/**
* Add a contact into database
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 697e5e8bdeb..e43fa769344 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2057,17 +2057,27 @@ class Form
{
global $langs,$conf;
global $price_level, $status, $finished;
-
+
+ $selected_input_value='';
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
{
+ if ($selected > 0)
+ {
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+ $producttmpselect = new Product($this->db);
+ $producttmpselect->fetch($selected);
+ $selected_input_value=$producttmpselect->ref;
+ unset($producttmpselect);
+ }
+
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
{
print '';
}
// mode=2 means suppliers products
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished;
- print ajax_autocompleter('', $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
- print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'';
+ print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
+ print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'';
}
else
{
@@ -2089,7 +2099,7 @@ class Form
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param string $filtre Pour filtre sql
* @param string $filterkey Filtre des produits
- * @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell
+ * @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request)
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit of line number
* @return array Array of keys for json
@@ -2106,7 +2116,7 @@ class Form
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
- $sql.= " pfp.supplier_reputation";
+ $sql.= " pfp.supplier_reputation";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index ce495a771d8..4f08650e56b 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -346,7 +346,8 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
'DB_ERROR_NO_INDEX_TO_DROP',
'DB_ERROR_CANNOT_CREATE', // Qd contrainte deja existante
'DB_ERROR_CANT_DROP_PRIMARY_KEY',
- 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS'
+ 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
+ 'DB_ERROR_22P02'
);
if ($okerror == 'none') $okerrors=array();
@@ -928,7 +929,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; }
if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; }
if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; }
-
+
if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort)
{
print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index 4b3ab3b32f4..8cc14987aa5 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -136,7 +136,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
minLength: '.$minLength.',
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
- $("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
+ console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
+ $("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element
if (options.option_disabled) {
if (ui.item.disabled) {
@@ -179,7 +180,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}
});
}
- console.log("ajax_autocompleter new value selected, we trigger change on original component");
+ console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}
,delay: 500
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 69f01613f50..66fb1031d6e 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -89,6 +89,46 @@ class Fichinter extends CommonObject
$this->statuts_logo[3]='statut4';
}
+ /**
+ * Load indicators into this->nb for board
+ *
+ * @return int <0 if KO, >0 if OK
+ */
+ function load_state_board()
+ {
+ global $user;
+
+ $this->nb=array();
+ $clause = "WHERE";
+
+ $sql = "SELECT count(fi.rowid) as nb";
+ $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as fi";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON fi.fk_soc = s.rowid";
+ if (!$user->rights->societe->client->voir && !$user->societe_id)
+ {
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
+ $sql.= " WHERE sc.fk_user = " .$user->id;
+ $clause = "AND";
+ }
+ $sql.= " ".$clause." fi.entity IN (".getEntity($this->element, 1).")";
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ while ($obj=$this->db->fetch_object($resql))
+ {
+ $this->nb["fichinters"]=$obj->nb;
+ }
+ $this->db->free($resql);
+ return 1;
+ }
+ else
+ {
+ dol_print_error($this->db);
+ $this->error=$this->db->error();
+ return -1;
+ }
+ }
/**
* Create an intervention into data base
diff --git a/htdocs/index.php b/htdocs/index.php
index 332e2ea4483..5e9492d9b50 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -162,6 +162,7 @@ if (empty($user->societe_id))
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
+ ! empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
! empty($conf->adherent->enabled) && $user->rights->adherent->lire,
! empty($conf->product->enabled) && $user->rights->produit->lire,
! empty($conf->service->enabled) && $user->rights->service->lire,
@@ -169,6 +170,7 @@ if (empty($user->societe_id))
! empty($conf->commande->enabled) && $user->rights->commande->lire,
! empty($conf->facture->enabled) && $user->rights->facture->lire,
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
+ ! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
@@ -181,6 +183,7 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
+ DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
DOL_DOCUMENT_ROOT."/product/class/product.class.php",
DOL_DOCUMENT_ROOT."/product/class/service.class.php",
@@ -188,6 +191,7 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
+ DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
@@ -199,6 +203,7 @@ if (empty($user->societe_id))
'Client',
'Client',
'Fournisseur',
+ 'Contact',
'Adherent',
'Product',
'Service',
@@ -206,6 +211,7 @@ if (empty($user->societe_id))
'Commande',
'Facture',
'Contrat',
+ 'Fichinter',
'CommandeFournisseur',
'FactureFournisseur',
'SupplierProposal',
@@ -217,6 +223,7 @@ if (empty($user->societe_id))
'customers',
'prospects',
'suppliers',
+ 'contacts',
'members',
'products',
'services',
@@ -224,6 +231,7 @@ if (empty($user->societe_id))
'orders',
'invoices',
'Contracts',
+ 'fichinters',
'supplier_orders',
'supplier_invoices',
'askprice',
@@ -235,6 +243,7 @@ if (empty($user->societe_id))
'company',
'company',
'company',
+ 'contact',
'user',
'product',
'service',
@@ -243,6 +252,7 @@ if (empty($user->societe_id))
'bill',
'order',
'order',
+ 'order',
'bill',
'propal',
'trip',
@@ -253,6 +263,7 @@ if (empty($user->societe_id))
"ThirdPartyCustomersStats",
"ThirdPartyProspectsStats",
"Suppliers",
+ "Contacts",
"Members",
"Products",
"Services",
@@ -260,6 +271,7 @@ if (empty($user->societe_id))
"CustomersOrders",
"BillsCustomers",
"Contracts",
+ "Interventions",
"SuppliersOrders",
"SuppliersInvoices",
"SupplierProposalShort",
@@ -272,6 +284,7 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/societe/list.php?type=c',
DOL_URL_ROOT.'/societe/list.php?type=p',
DOL_URL_ROOT.'/societe/list.php?type=f',
+ DOL_URL_ROOT.'/contact/list.php',
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
@@ -279,6 +292,7 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial',
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
DOL_URL_ROOT.'/contrat/list.php',
+ DOL_URL_ROOT.'/fichinter/list.php',
DOL_URL_ROOT.'/fourn/commande/list.php',
DOL_URL_ROOT.'/fourn/facture/list.php',
DOL_URL_ROOT.'/supplier_proposal/list.php',
@@ -290,6 +304,7 @@ if (empty($user->societe_id))
"companies",
"prospects",
"suppliers",
+ "companies",
"members",
"products",
"produts",
@@ -298,6 +313,7 @@ if (empty($user->societe_id))
"bills",
"supplier_proposal",
"contracts",
+ "interventions",
"trips",
"projects"
);
diff --git a/htdocs/install/mysql/data/llx_accounting_category.sql b/htdocs/install/mysql/data/llx_accounting_category.sql
new file mode 100644
index 00000000000..5769d291563
--- /dev/null
+++ b/htdocs/install/mysql/data/llx_accounting_category.sql
@@ -0,0 +1,29 @@
+-- Copyright (C) 2016 Alexandre Spangaro
+--
+-- 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 .
+--
+--
+
+--
+-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
+-- de l'install et tous les sigles '--' sont supprimés.
+--
+
+--
+-- Categories compte de résultat Français
+--
+
+INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
+INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d\'achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
+INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
\ No newline at end of file
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
index 832107e7f6f..df9b7aa3450 100644
--- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -66,6 +66,8 @@ ALTER TABLE llx_product ADD COLUMN height_units tinyint DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
+ALTER TABLE llx_product MODIFY COLUMN stock real;
+
CREATE TABLE llx_categorie_user
(
fk_categorie integer NOT NULL,
@@ -303,19 +305,15 @@ ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_ht double(24,8) DEFAUL
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_tva double(24,8) DEFAULT 0;
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_total_ttc double(24,8) DEFAULT 0;
-
-
ALTER TABLE llx_paiement ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_paiement_facture ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_paiementfourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_paiementfourn_facturefourn ADD COLUMN multicurrency_amount double(24,8) DEFAULT 0;
-ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ht double(24,8) NOT NULL;
+ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ht double(24,8) DEFAULT 0 NOT NULL;
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL;
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL;
-
-
ALTER TABLE llx_supplier_proposal ADD COLUMN fk_multicurrency integer;
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_code varchar(255);
ALTER TABLE llx_supplier_proposal ADD COLUMN multicurrency_tx double(24,8) DEFAULT 1;
@@ -366,11 +364,18 @@ CREATE TABLE llx_c_accounting_category (
) ENGINE=innodb;
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code);
+
+INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE',"Ventes de marchandises", '707xxx', 0, 0, '', '10', 1, 1);
+INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR',"Coût d'achats marchandises vendues", '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
+INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE',"Marge commerciale", '', 0, 1, '1 + 2', '30', 1, 1);
+
UPDATE llx_accounting_account SET account_parent = '0' WHERE account_parent = '';
-ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0;
+-- VMYSQL4.1 ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0;
+-- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_parent TYPE integer USING account_parent::integer;
-DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque;
+-- VMYSQL4.1 DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque;
+-- VPGSQL8.2 DROP INDEX uk_bordereau_cheque;
ALTER TABLE llx_bordereau_cheque CHANGE COLUMN number ref VARCHAR(30) NOT NULL;
CREATE UNIQUE INDEX uk_bordereau_cheque ON llx_bordereau_cheque (ref, entity);
diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql
index d74c1b75105..51346cc63f6 100644
--- a/htdocs/install/mysql/tables/llx_accounting_account.sql
+++ b/htdocs/install/mysql/tables/llx_accounting_account.sql
@@ -29,7 +29,7 @@ create table llx_accounting_account
pcg_type varchar(20) NOT NULL,
pcg_subtype varchar(20) NOT NULL,
account_number varchar(32) NOT NULL,
- account_parent integer, -- Hierarchic parent
+ account_parent integer DEFAULT 0, -- Hierarchic parent
label varchar(255) NOT NULL,
fk_accounting_category integer DEFAULT 0,
fk_user_author integer DEFAULT NULL,
diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql
index 9d3446d696d..8b43844498e 100755
--- a/htdocs/install/mysql/tables/llx_product.sql
+++ b/htdocs/install/mysql/tables/llx_product.sql
@@ -79,7 +79,7 @@ create table llx_product
surface_units tinyint DEFAULT NULL,
volume float DEFAULT NULL,
volume_units tinyint DEFAULT NULL,
- stock integer, -- Current physical stock (dernormalized field)
+ stock real, -- Current physical stock (dernormalized field)
pmp double(24,8) DEFAULT 0 NOT NULL, -- To store valuation of stock calculated using average price method, for this product
fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product
lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product
diff --git a/htdocs/install/mysql/tables/llx_societe_remise_except.sql b/htdocs/install/mysql/tables/llx_societe_remise_except.sql
index ef84e0081d6..f17d17670d2 100644
--- a/htdocs/install/mysql/tables/llx_societe_remise_except.sql
+++ b/htdocs/install/mysql/tables/llx_societe_remise_except.sql
@@ -33,7 +33,7 @@ create table llx_societe_remise_except
fk_facture integer,
fk_facture_source integer,
description text NOT NULL,
- multicurrency_amount_ht double(24,8) NOT NULL,
+ multicurrency_amount_ht double(24,8) DEFAULT 0 NOT NULL,
multicurrency_amount_tva double(24,8) DEFAULT 0 NOT NULL,
multicurrency_amount_ttc double(24,8) DEFAULT 0 NOT NULL
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql
index 3db9a4475cd..3ac42c0c852 100644
--- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql
+++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql
@@ -24,8 +24,8 @@ create table llx_stock_mouvement
datem datetime, -- Date and hour of movement
fk_product integer NOT NULL, -- Id of product
batch varchar(30) DEFAULT NULL, -- Lot or serial number
- eatby date DEFAULT NULL, -- Eatby date
- sellby date DEFAULT NULL, -- Sellby date
+ eatby date DEFAULT NULL, -- Eatby date (deprecated, we should get value from batch number in table llx_product_lot)
+ sellby date DEFAULT NULL, -- Sellby date (deprecated, we should get value from batch number in table llx_product_lot)
fk_entrepot integer NOT NULL, -- Id warehouse
value real, -- Qty of movement
price double(24,8) DEFAULT 0, -- Entry price (used to calculate PMP, FIFO or LIFO value)
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 9fe7c6544fb..64c0d88df48 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -174,6 +174,9 @@ OptionModeProductBuyDesc=Show all products with no accounting account defined fo
## Dictionary
Range=Range of accounting account
+Sens=Sens
+Calculated=Calculated
+Formula=Formula
## Error
ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country
\ No newline at end of file
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index e3c0b5108fc..c6526b51d28 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -59,6 +59,8 @@ SpecialExpensesArea=Area for all special payments
TaxAndDividendsArea=Sale taxes, social/fiscal taxes contributions and dividends area
SocialContribution=Social or fiscal tax
SocialContributions=Social or fiscal taxes
+SocialContributionsDeductibles=Deductible social or fiscal taxes
+SocialContributionsNondeductibles=Nondeductible social or fiscal taxes
MenuSpecialExpenses=Special expenses
MenuTaxAndDividends=Taxes and dividends
MenuSalaries=Salaries
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 23ce2ba7f11..92d8a7f4288 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -8,12 +8,12 @@
* Copyright (C) 2010-2015 Juanjo Menent
* Copyright (C) 2013-2014 Marcos García
* Copyright (C) 2012-2013 Cédric Salvador
- * Copyright (C) 2011-2015 Alexandre Spangaro
+ * Copyright (C) 2011-2016 Alexandre Spangaro
* Copyright (C) 2014 Cédric Gross
* Copyright (C) 2014-2015 Ferran Marcet
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2015 Raphaël Doursenaud
- * Copyright (C) 2016 Charlie Benke
+ * Copyright (C) 2016 Charlie Benke
*
* 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
@@ -1476,24 +1476,26 @@ else
}
// Accountancy sell code
- if (! empty($conf->accounting->enabled)){
- print '