diff --git a/ChangeLog b/ChangeLog
index 1938040f92e..15f31a52fbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,7 @@ For users:
- New: Can send an email from thirdparty card.
- New: Can cancel holidays that were previously validated.
- Fix: [bug #1022] correct margin calculation for credit notes.
+- New: Can choose contact on event (action com) creation, and filtred by thirdparty
For translators:
- Qual: Normalized sort order of all languages files with english reference files.
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 0607fdd6e0e..f03d09cd5a5 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -564,23 +564,23 @@ if ($action == 'create')
}
else
{
+
+ $events=array();
+ $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
//For external user force the company to user company
if (!empty($user->societe_id)) {
- print $form->select_company($user->societe_id,'socid','',1,1);
+ print $form->select_company($user->societe_id,'socid','',1,1,0,$events);
} else {
- print $form->select_company('','socid','',1,1);
+ print $form->select_company('','socid','',1,1,0,$events);
}
}
print '';
- // If company is forced, we propose contacts (may be contact is also forced)
- if (GETPOST("contactid") > 0 || GETPOST('socid','int') > 0)
- {
- print '
';
}
diff --git a/htdocs/install/mysql/tables/llx_actioncomm_extrafields.key.sql b/htdocs/install/mysql/tables/llx_actioncomm_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql b/htdocs/install/mysql/tables/llx_actioncomm_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_adherent_extrafields.key.sql b/htdocs/install/mysql/tables/llx_adherent_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_adherent_extrafields.sql b/htdocs/install/mysql/tables/llx_adherent_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_adherent_type_extrafields.key.sql b/htdocs/install/mysql/tables/llx_adherent_type_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_adherent_type_extrafields.sql b/htdocs/install/mysql/tables/llx_adherent_type_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_c_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_c_actioncomm.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_c_availability.key.sql b/htdocs/install/mysql/tables/llx_c_availability.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_c_barcode_type.key.sql b/htdocs/install/mysql/tables/llx_c_barcode_type.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_c_input_method.key.sql b/htdocs/install/mysql/tables/llx_c_input_method.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_c_input_method.sql b/htdocs/install/mysql/tables/llx_c_input_method.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_c_input_reason.key.sql b/htdocs/install/mysql/tables/llx_c_input_reason.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_c_input_reason.sql b/htdocs/install/mysql/tables/llx_c_input_reason.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_commande_extrafields.key.sql b/htdocs/install/mysql/tables/llx_commande_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_commande_extrafields.sql b/htdocs/install/mysql/tables/llx_commande_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_commandedet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_commandedet_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_commandedet_extrafields.sql b/htdocs/install/mysql/tables/llx_commandedet_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_extrafields.key.sql b/htdocs/install/mysql/tables/llx_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_facture_extrafields.key.sql b/htdocs/install/mysql/tables/llx_facture_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_facture_extrafields.sql b/htdocs/install/mysql/tables/llx_facture_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.sql b/htdocs/install/mysql/tables/llx_facture_fourn_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_facturedet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_facturedet_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_facturedet_extrafields.sql b/htdocs/install/mysql/tables/llx_facturedet_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_fichinter_extrafields.key.sql b/htdocs/install/mysql/tables/llx_fichinter_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_paiementcharge.sql b/htdocs/install/mysql/tables/llx_paiementcharge.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_product_association.key.sql b/htdocs/install/mysql/tables/llx_product_association.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_product_association.sql b/htdocs/install/mysql/tables/llx_product_association.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_product_extrafields.key.sql b/htdocs/install/mysql/tables/llx_product_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_product_extrafields.sql b/htdocs/install/mysql/tables/llx_product_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_projet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_projet_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_projet_extrafields.sql b/htdocs/install/mysql/tables/llx_projet_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_projet_task_extrafields.key.sql b/htdocs/install/mysql/tables/llx_projet_task_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_projet_task_extrafields.sql b/htdocs/install/mysql/tables/llx_projet_task_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_propal_extrafields.key.sql b/htdocs/install/mysql/tables/llx_propal_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_propal_extrafields.sql b/htdocs/install/mysql/tables/llx_propal_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_propaldet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_propaldet_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_propaldet_extrafields.sql b/htdocs/install/mysql/tables/llx_propaldet_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_societe_extrafields.key.sql b/htdocs/install/mysql/tables/llx_societe_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_societe_extrafields.sql b/htdocs/install/mysql/tables/llx_societe_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_socpeople_extrafields.key.sql b/htdocs/install/mysql/tables/llx_socpeople_extrafields.key.sql
old mode 100755
new mode 100644
diff --git a/htdocs/install/mysql/tables/llx_socpeople_extrafields.sql b/htdocs/install/mysql/tables/llx_socpeople_extrafields.sql
old mode 100755
new mode 100644
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index 374acec166b..80b8fb352ac 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -27,6 +27,7 @@ ListOfStockMovements=List of stock movements
StocksArea=Stocks area
Location=Location
LocationSummary=Short name location
+NumberOfDifferentProducts=Number of different products
NumberOfProducts=Total number of products
LastMovement=Last movement
LastMovements=Last movements
@@ -98,3 +99,4 @@ SelectProduct=Select at least one product
AlertOnly= Alerts only
WarehouseForStockDecrease=The warehouse %s will be used for stock decrease
WarehouseForStockIncrease=The warehouse %s will be used for stock increase
+ForThisWarehouse=For this warehouse
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang
index 0d87f7e5140..934e0b59b99 100644
--- a/htdocs/langs/fr_FR/stocks.lang
+++ b/htdocs/langs/fr_FR/stocks.lang
@@ -27,6 +27,7 @@ ListOfStockMovements=Liste des mouvements de stock
StocksArea=Espace stocks
Location=Lieu
LocationSummary=Nom court du lieu
+NumberOfDifferentProducts=Nombre de produits différents
NumberOfProducts=Nombre total de produits
LastMovement=Dernier mouvement
LastMovements=Derniers mouvements
@@ -98,3 +99,4 @@ SelectProduct=Sélectionnez au moins un produit
AlertOnly = Alertes seulement
WarehouseForStockDecrease=L'entrepôt %s sera utilisé pour la décrémentation du stock
WarehouseForStockIncrease=L'entrepôt %s sera utilisé pour l'incrémentation du stock
+ForThisWarehouse=Pour cet entrepôt
\ No newline at end of file
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index 580b729c8c3..384b3712674 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -243,15 +243,15 @@ class Entrepot extends CommonObject
function fetch($id, $ref='')
{
global $conf;
-
+
$sql = "SELECT rowid, label, description, statut, lieu, address, zip, town, fk_pays as country_id";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
-
- if ($id)
+
+ if ($id)
{
$sql.= " WHERE rowid = '".$id."'";
}
-
+
else
{
$sql.= " WHERE entity = " .$conf->entity;
@@ -276,12 +276,12 @@ class Entrepot extends CommonObject
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->country_id = $obj->country_id;
-
+
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$tmp=getCountry($this->country_id,'all');
$this->country=$tmp['label'];
$this->country_code=$tmp['code'];
-
+
return 1;
}
else
@@ -377,6 +377,38 @@ class Entrepot extends CommonObject
return $liste;
}
+ /**
+ * Return number of unique different product into a warehosue
+ *
+ * @return Array Array('nb'=>Nb, 'value'=>Value)
+ */
+ function nb_different_products()
+ {
+ $ret=array();
+
+ $sql = "SELECT count(distinct p.rowid) as nb";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
+ $sql.= ", ".MAIN_DB_PREFIX."product as p";
+ $sql.= " WHERE ps.fk_entrepot = ".$this->id;
+ $sql.= " AND ps.fk_product = p.rowid";
+
+ //print $sql;
+ $result = $this->db->query($sql);
+ if ($result)
+ {
+ $obj = $this->db->fetch_object($result);
+ $ret['nb']=$obj->nb;
+ $this->db->free($result);
+ }
+ else
+ {
+ $this->error=$this->db->lasterror();
+ return -1;
+ }
+
+ return $ret;
+ }
+
/**
* Return stock and value of warehosue
*
diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php
index 1d0a9c08e04..104f92a84a9 100644
--- a/htdocs/product/stock/fiche.php
+++ b/htdocs/product/stock/fiche.php
@@ -276,8 +276,14 @@ else
// Status
print '
'.$langs->trans("Status").'
'.$object->getLibStatut(4).'
';
+ $calcproductsunique=$object->nb_different_products();
$calcproducts=$object->nb_products();
+ // Total nb of different products
+ print '
';
print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
@@ -392,8 +398,8 @@ if ($resql)
if ($snom) $param.='&snom='.urlencode($snom);
if ($search_user) $param.='&search_user='.urlencode($search_user);
if ($idproduct > 0) $param.='&idproduct='.$idproduct;
- if ($id) print_barre_liste($texte, $page, "mouvement.php", $param, $sortfield, $sortorder,'',$num,0,'');
- else print_barre_liste($texte, $page, "mouvement.php", $param, $sortfield, $sortorder,'',$num);
+ if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,'');
+ else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
print '
';
print "
";
@@ -401,7 +407,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"], "m.datem","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Product"),$_SERVER["PHP_SELF"], "p.ref","",$param,"",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible
print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Units"),$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder);
print "