Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2013-10-04 15:10:06 +02:00
commit 2e3aad282c
56 changed files with 73 additions and 22 deletions

View File

@ -61,6 +61,7 @@ For users:
- New: Can send an email from thirdparty card. - New: Can send an email from thirdparty card.
- New: Can cancel holidays that were previously validated. - New: Can cancel holidays that were previously validated.
- Fix: [bug #1022] correct margin calculation for credit notes. - Fix: [bug #1022] correct margin calculation for credit notes.
- New: Can choose contact on event (action com) creation, and filtred by thirdparty
For translators: For translators:
- Qual: Normalized sort order of all languages files with english reference files. - Qual: Normalized sort order of all languages files with english reference files.

View File

@ -564,23 +564,23 @@ if ($action == 'create')
} }
else 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 //For external user force the company to user company
if (!empty($user->societe_id)) { 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 { } else {
print $form->select_company('','socid','',1,1); print $form->select_company('','socid','',1,1,0,$events);
} }
} }
print '</td></tr>'; print '</td></tr>';
// If company is forced, we propose contacts (may be contact is also forced) print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
if (GETPOST("contactid") > 0 || GETPOST('socid','int') > 0) $form->select_contacts(GETPOST('socid','int'),GETPOST('contactid'),'contactid',1);
{ print '</td></tr>';
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
$form->select_contacts(GETPOST('socid','int'),GETPOST('contactid'),'contactid',1);
print '</td></tr>';
}
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
@ -809,12 +809,14 @@ if ($id > 0)
{ {
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>'; print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>';
print '<td>'; print '<td>';
print $form->select_company($act->societe->id,'socid','',1,1); $events=array();
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print $form->select_company($act->societe->id,'socid','',1,1,0,$events);
print '</td>'; print '</td>';
// Contact // Contact
print '<td>'.$langs->trans("Contact").'</td><td width="30%">'; print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
print $form->selectarray("contactid", (empty($act->societe->id)?array():$act->societe->contact_array()), $act->contact->id, 1); $form->select_contacts($act->societe->id, $act->contact->id,'contactid',1);
print '</td></tr>'; print '</td></tr>';
} }

View File

View File

View File

View File

View File

View File

0
htdocs/install/mysql/tables/llx_c_actioncomm.key.sql Executable file → Normal file
View File

0
htdocs/install/mysql/tables/llx_c_availability.key.sql Executable file → Normal file
View File

0
htdocs/install/mysql/tables/llx_c_barcode_type.key.sql Executable file → Normal file
View File

0
htdocs/install/mysql/tables/llx_c_input_method.key.sql Executable file → Normal file
View File

0
htdocs/install/mysql/tables/llx_c_input_method.sql Executable file → Normal file
View File

0
htdocs/install/mysql/tables/llx_c_input_reason.key.sql Executable file → Normal file
View File

0
htdocs/install/mysql/tables/llx_c_input_reason.sql Executable file → Normal file
View File

View File

View File

View File

View File

0
htdocs/install/mysql/tables/llx_extrafields.key.sql Executable file → Normal file
View File

0
htdocs/install/mysql/tables/llx_extrafields.sql Executable file → Normal file
View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

0
htdocs/install/mysql/tables/llx_opensurvey_sondage.sql Executable file → Normal file
View File

View File

View File

0
htdocs/install/mysql/tables/llx_paiementcharge.sql Executable file → Normal file
View File

View File

View File

View File

View File

View File

0
htdocs/install/mysql/tables/llx_projet_extrafields.sql Executable file → Normal file
View File

View File

View File

View File

0
htdocs/install/mysql/tables/llx_propal_extrafields.sql Executable file → Normal file
View File

View File

View File

View File

View File

View File

View File

View File

@ -27,6 +27,7 @@ ListOfStockMovements=List of stock movements
StocksArea=Stocks area StocksArea=Stocks area
Location=Location Location=Location
LocationSummary=Short name location LocationSummary=Short name location
NumberOfDifferentProducts=Number of different products
NumberOfProducts=Total number of products NumberOfProducts=Total number of products
LastMovement=Last movement LastMovement=Last movement
LastMovements=Last movements LastMovements=Last movements
@ -98,3 +99,4 @@ SelectProduct=Select at least one product
AlertOnly= Alerts only AlertOnly= Alerts only
WarehouseForStockDecrease=The warehouse <b>%s</b> will be used for stock decrease WarehouseForStockDecrease=The warehouse <b>%s</b> will be used for stock decrease
WarehouseForStockIncrease=The warehouse <b>%s</b> will be used for stock increase WarehouseForStockIncrease=The warehouse <b>%s</b> will be used for stock increase
ForThisWarehouse=For this warehouse

View File

@ -27,6 +27,7 @@ ListOfStockMovements=Liste des mouvements de stock
StocksArea=Espace stocks StocksArea=Espace stocks
Location=Lieu Location=Lieu
LocationSummary=Nom court du lieu LocationSummary=Nom court du lieu
NumberOfDifferentProducts=Nombre de produits différents
NumberOfProducts=Nombre total de produits NumberOfProducts=Nombre total de produits
LastMovement=Dernier mouvement LastMovement=Dernier mouvement
LastMovements=Derniers mouvements LastMovements=Derniers mouvements
@ -98,3 +99,4 @@ SelectProduct=Sélectionnez au moins un produit
AlertOnly = Alertes seulement AlertOnly = Alertes seulement
WarehouseForStockDecrease=L'entrepôt <b>%s</b> sera utilisé pour la décrémentation du stock WarehouseForStockDecrease=L'entrepôt <b>%s</b> sera utilisé pour la décrémentation du stock
WarehouseForStockIncrease=L'entrepôt <b>%s</b> sera utilisé pour l'incrémentation du stock WarehouseForStockIncrease=L'entrepôt <b>%s</b> sera utilisé pour l'incrémentation du stock
ForThisWarehouse=Pour cet entrepôt

View File

@ -243,15 +243,15 @@ class Entrepot extends CommonObject
function fetch($id, $ref='') function fetch($id, $ref='')
{ {
global $conf; global $conf;
$sql = "SELECT rowid, label, description, statut, lieu, address, zip, town, fk_pays as country_id"; $sql = "SELECT rowid, label, description, statut, lieu, address, zip, town, fk_pays as country_id";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id) if ($id)
{ {
$sql.= " WHERE rowid = '".$id."'"; $sql.= " WHERE rowid = '".$id."'";
} }
else else
{ {
$sql.= " WHERE entity = " .$conf->entity; $sql.= " WHERE entity = " .$conf->entity;
@ -276,12 +276,12 @@ class Entrepot extends CommonObject
$this->zip = $obj->zip; $this->zip = $obj->zip;
$this->town = $obj->town; $this->town = $obj->town;
$this->country_id = $obj->country_id; $this->country_id = $obj->country_id;
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$tmp=getCountry($this->country_id,'all'); $tmp=getCountry($this->country_id,'all');
$this->country=$tmp['label']; $this->country=$tmp['label'];
$this->country_code=$tmp['code']; $this->country_code=$tmp['code'];
return 1; return 1;
} }
else else
@ -377,6 +377,38 @@ class Entrepot extends CommonObject
return $liste; 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 * Return stock and value of warehosue
* *

View File

@ -276,8 +276,14 @@ else
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
$calcproductsunique=$object->nb_different_products();
$calcproducts=$object->nb_products(); $calcproducts=$object->nb_products();
// Total nb of different products
print '<tr><td valign="top">'.$langs->trans("NumberOfDifferentProducts").'</td><td colspan="3">';
print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb'];
print "</td></tr>";
// Nb of products // Nb of products
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
print empty($calcproducts['nb'])?'0':$calcproducts['nb']; print empty($calcproducts['nb'])?'0':$calcproducts['nb'];

View File

@ -190,9 +190,9 @@ if ($resql)
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks'; $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
$texte = $langs->trans("ListOfStockMovements"); $texte = $langs->trans("ListOfStockMovements");
$texte.=' ('.$langs->trans("ForThisWarehouse").')';
llxHeader("",$texte,$help_url); llxHeader("",$texte,$help_url);
/* /*
* Show tab only if we ask a particular warehouse * Show tab only if we ask a particular warehouse
*/ */
@ -236,8 +236,14 @@ if ($resql)
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
$calcproductsunique=$entrepot->nb_different_products();
$calcproducts=$entrepot->nb_products(); $calcproducts=$entrepot->nb_products();
// Total nb of different products
print '<tr><td valign="top">'.$langs->trans("NumberOfDifferentProducts").'</td><td colspan="3">';
print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb'];
print "</td></tr>";
// Nb of products // Nb of products
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
print empty($calcproducts['nb'])?'0':$calcproducts['nb']; print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
@ -392,8 +398,8 @@ if ($resql)
if ($snom) $param.='&snom='.urlencode($snom); if ($snom) $param.='&snom='.urlencode($snom);
if ($search_user) $param.='&search_user='.urlencode($search_user); if ($search_user) $param.='&search_user='.urlencode($search_user);
if ($idproduct > 0) $param.='&idproduct='.$idproduct; if ($idproduct > 0) $param.='&idproduct='.$idproduct;
if ($id) print_barre_liste($texte, $page, "mouvement.php", $param, $sortfield, $sortorder,'',$num,0,''); if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,'');
else print_barre_liste($texte, $page, "mouvement.php", $param, $sortfield, $sortorder,'',$num); else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
@ -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("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("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("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("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_liste_field_titre($langs->trans("Units"),$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
@ -426,7 +432,7 @@ if ($resql)
print '<input class="flat" type="text" size="12" name="search_product" value="'.($idproduct?$product->libelle:$search_product).'">'; print '<input class="flat" type="text" size="12" name="search_product" value="'.($idproduct?$product->libelle:$search_product).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="search_warehouse" value="'.($search_warehouse).'">'; //print '<input class="flat" type="text" size="10" name="search_warehouse" value="'.($search_warehouse).'">'; // We are on a specific warehouse card, no filter on other should be possible
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.($search_user).'">'; print '<input class="flat" type="text" size="6" name="search_user" value="'.($search_user).'">';