';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index a8cd12c1884..ec99e78cf53 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -506,7 +506,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $db->num_rows($result);
}
-$sql.= $db->plimit($limit+1,$offset);
+$sql.= $db->plimit($limit,$offset);
//print $sql;
$resql = $db->query($sql);
diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php
index a709a7aef3a..2b3c69a9e15 100644
--- a/htdocs/core/boxes/box_graph_product_distribution.php
+++ b/htdocs/core/boxes/box_graph_product_distribution.php
@@ -249,6 +249,8 @@ class box_graph_product_distribution extends ModeleBoxes
if (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire))
{
+ $langs->load("orders");
+
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showordernb)
{
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 99fc6829899..e03db1b4773 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3162,8 +3162,16 @@ abstract class CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
- $res = $this->db->fetch_object($resql);
- return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
+ $num = $this->db->num_rows($resql);
+ if ($num > 0)
+ {
+ $res = $this->db->fetch_object($resql);
+ return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
+ }
+ else
+ {
+ return '';
+ }
}
else
{
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 939d8300661..b839e46dc8b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -951,36 +951,40 @@ class Form
/**
* Output html form to select a third party
*
- * @param string $selected Preselected type
- * @param string $htmlname Name of field in form
- * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)')
- * @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty')
- * @param int $showtype Show third party type in combolist (customer, prospect or supplier)
- * @param int $forcecombo Force to use combo box
- * @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
- * @param int $limit Maximum number of elements
- * @param string $morecss Add more css styles to the SELECT component
- * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
- * @return string HTML string with select box for thirdparty.
+ * @param string $selected Preselected type
+ * @param string $htmlname Name of field in form
+ * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)')
+ * @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty')
+ * @param int $showtype Show third party type in combolist (customer, prospect or supplier)
+ * @param int $forcecombo Force to use combo box
+ * @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
+ * @param int $limit Maximum number of elements
+ * @param string $morecss Add more css styles to the SELECT component
+ * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
+ * @param string $selected_input_value Value of preselected input text (for use with ajax)
+ * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
+ * @param array $ajaxoptions Options for ajax_autocompleter
+ * @return string HTML string with select box for thirdparty.
*/
- function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='')
+ function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array())
{
+ global $conf,$user,$langs;
+
$out='';
- /* TODO Use ajax_autocompleter like for products (not finished)
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo)
{
$placeholder='';
-
if ($selected && empty($selected_input_value))
{
- require_once DOL_DOCUMENT_ROOT.'/societe/ajaxcompanies.php';
- $societe = new Societe($this->db);
- $societe->fetch($selected);
- $selected_input_value=$societe->ref;
+ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+ $societetmp = new Societe($this->db);
+ $societetmp->fetch($selected);
+ $selected_input_value=$societetmp->name;
+ unset($societetmp);
}
- // mode=1 means customers products
- $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished;
+ // mode 1
+ $urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) {
@@ -990,15 +994,15 @@ class Form
print img_picto($langs->trans("Search"), 'search');
}
}
- print '';
+ print 'global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
if ($hidelabel == 3) {
print img_picto($langs->trans("Search"), 'search');
}
}
else
- {*/
+ {
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam);
- //}
+ }
return $out;
}
@@ -1024,7 +1028,8 @@ class Form
{
global $conf,$user,$langs;
- $out=''; $num=0;
+ $out='';
+ $num=0;
$outarray=array();
// On recherche les societes
@@ -1040,19 +1045,18 @@ class Form
if ($filterkey && $filterkey != '')
{
$sql.=" AND (";
- if (! empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index
- {
- $sql.="(s.name LIKE '".$this->db->escape($filterkey)."%')";
+ $prefix=empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)?'%':''; // Can use index if COMPANY_DONOTSEARCH_ANYWHERE is on
+ // For natural search
+ $scrit = explode(' ', $filterkey);
+ $i=0;
+ if (count($scrit) > 1) $sql.="(";
+ foreach ($scrit as $crit) {
+ if ($i > 0) $sql.=" AND ";
+ $sql.="(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
+ $i++;
}
- else
- {
- // For natural search
- $scrit = explode(' ', $filterkey);
- foreach ($scrit as $crit) {
- $sql.=" AND (s.name LIKE '%".$this->db->escape($crit)."%')";
- }
- }
- if (! empty($conf->barcode->enabled))
+ if (count($scrit) > 1) $sql.=")";
+ if (! empty($conf->barcode->enabled))
{
$sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'";
}
@@ -1061,10 +1065,13 @@ class Form
$sql.=$this->db->order("nom","ASC");
if ($limit > 0) $sql.=$this->db->plimit($limit);
+ // Build output string
dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
+ $events = null;
+
if ($conf->use_javascript_ajax && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
@@ -1085,7 +1092,7 @@ class Form
}
if ($showempty) $out.= ''."\n";
- $num = $this->db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
$i = 0;
if ($num)
{
@@ -1128,7 +1135,7 @@ class Form
$out.= '';
}
- array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->rowid, 'label'=>$label));
+ array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label));
$i++;
if (($i % 10) == 0) $out.="\n";
@@ -3370,11 +3377,14 @@ class Form
print '';
print '';
} else {
+
+ $langs->load('banks');
+
if ($selected) {
require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
$bankstatic=new Account($this->db);
$bankstatic->fetch($selected);
- print $this->textwithpicto($bankstatic->label,$langs->trans("AccountCurrency").' '.$bankstatic->currency_code);
+ print $this->textwithpicto($bankstatic->getNomUrl(1),$langs->trans("AccountCurrency").' '.$bankstatic->currency_code);
} else {
print " ";
}
@@ -5576,19 +5586,19 @@ class Form
$possiblelinks=array();
if (is_object($object->thirdparty) && ! empty($object->thirdparty->id) && $object->thirdparty->id > 0)
{
- $listofidcompanytoscan=$object->thirdparty->id;
- if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent;
-
- $possiblelinks=array(
- 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')'),
- 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')'),
- 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')'),
- 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')'),
- 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')'),
- 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')'),
- 'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')'),
- 'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.')')
- );
+ $listofidcompanytoscan=$object->thirdparty->id;
+ if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent;
+
+ $possiblelinks=array(
+ 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal',1).')'),
+ 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande',1).')'),
+ 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture',1).')'),
+ 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract',1).')'),
+ 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention',1).')'),
+ 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal',1).')'),
+ 'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur',1).')'),
+ 'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn',1).')')
+ );
}
global $action;
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 8d1705ca4d4..1f83690b096 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -118,7 +118,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '
';
print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_logos')?GETPOST('restore_thirdparties_logos'):'0').' '."\n";
print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements')?GETPOST('clean_linked_elements'):'0').' '."\n";
-print 'Option clean_orphelin_dir (1 or confirmed) is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').' '."\n";
-print 'Option clean_product_stock_batch (1 or confirmed) is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').' '."\n";
-print 'Option set_empty_time_spent_amount (1 or confirmed) is '.(GETPOST('set_empty_time_spent_amount')?GETPOST('set_empty_time_spent_amount'):'0').' '."\n";
+print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').' '."\n";
+print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').' '."\n";
+print 'Option set_empty_time_spent_amount (0 or \'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount')?GETPOST('set_empty_time_spent_amount'):'0').' '."\n";
print ' ';
print '
';
@@ -547,14 +547,17 @@ if ($ok && GETPOST('clean_orphelin_dir'))
// clean_linked_elements: Check and clean linked elements
if ($ok && GETPOST('clean_product_stock_batch'))
{
- print '
*** Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)
';
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
- $sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
- $sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
+ $sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb ON ps.rowid = pb.fk_product_stock";
+ $sql.=" WHERE p.rowid = ps.fk_product";
$sql.=" AND p.tobatch = 1";
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
- $sql.=" HAVING reel != SUM(pb.qty)";
+ $sql.=" HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL";
+ print $sql;
$resql = $db->query($sql);
if ($resql)
{
@@ -566,13 +569,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
while ($i < $num)
{
$obj=$db->fetch_object($resql);
- print '
Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.($obj->reelbatch?$obj->reelbatch:'0').' (sum product_batch)';
// Fix
if ($obj->reel != $obj->reelbatch)
{
- $methodtofix='updatestock';
-
if ($methodtofix == 'updatebatch')
{
// Method 1
@@ -594,7 +595,7 @@ if ($ok && GETPOST('clean_product_stock_batch'))
if ($methodtofix == 'updatestock')
{
// Method 2
- print ' -> Update qty of stock with qty = '.$obj->reelbatch.' for ps.rowid = '.$obj->psrowid;
+ print ' -> Update qty of product_stock with qty = '.($obj->reelbatch?$obj->reelbatch:'0').' for ps.rowid = '.$obj->psrowid;
if (GETPOST('clean_product_stock_batch') == 'confirmed')
{
$error=0;
@@ -602,11 +603,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
$db->begin();
$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_stock";
- $sql2.=" SET reel = ".$obj->reelbatch." WHERE rowid = ".$obj->psrowid;
+ $sql2.=" SET reel = ".($obj->reelbatch?$obj->reelbatch:'0')." WHERE rowid = ".$obj->psrowid;
$resql2=$db->query($sql2);
if ($resql2)
{
- // We update product stock, so we must update product.stock too.
+ // We update product_stock, so we must field stock into product too.
$sql3='UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)';
$resql3=$db->query($sql3);
if (! $resql3)
@@ -632,6 +633,10 @@ if ($ok && GETPOST('clean_product_stock_batch'))
$i++;
}
}
+ else
+ {
+ print '
Nothing to do
';
+ }
}
else
{
@@ -640,6 +645,34 @@ if ($ok && GETPOST('clean_product_stock_batch'))
}
+// clean_linked_elements: Check and clean linked elements
+if ($ok && GETPOST('clean_product_stock_negative_if_batch'))
+{
+ print '
Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)
';
+
+ $sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
+ $sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
+ $sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
+ $sql.=" AND p.tobatch = 1";
+ $sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
+ $sql.=" HAVING reel != SUM(pb.qty)";
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+
+ if ($num)
+ {
+ $i = 0;
+ while ($i < $num)
+ {
+ $obj=$db->fetch_object($resql);
+ print '
'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
+
+ }
+ }
+ }
+}
// clean_linked_elements: Check and clean linked elements
if ($ok && GETPOST('set_empty_time_spent_amount'))
@@ -667,15 +700,18 @@ if ($ok && GETPOST('set_empty_time_spent_amount'))
$db->begin();
- $sql2 ="UPDATE ".MAIN_DB_PREFIX."projet_task_time";
- $sql2.=" SET thm = ".$obj->user_thm." WHERE thm IS NULL AND fk_user = ".$obj->user_id;
- $resql2=$db->query($sql2);
- if (! $resql2)
+ if (GETPOST('set_empty_time_spent_amount') == 'confirmed')
{
- $error++;
- dol_print_error($db);
+ $sql2 ="UPDATE ".MAIN_DB_PREFIX."projet_task_time";
+ $sql2.=" SET thm = ".$obj->user_thm." WHERE thm IS NULL AND fk_user = ".$obj->user_id;
+ $resql2=$db->query($sql2);
+ if (! $resql2)
+ {
+ $error++;
+ dol_print_error($db);
+ }
}
-
+
if (!$error) $db->commit();
else $db->rollback();
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index a4d6ab8d324..7432f0e2412 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -126,8 +126,8 @@ BillStatusClosedUnpaid=Closed (unpaid)
BillStatusClosedPaidPartially=Paid (partially)
BillShortStatusDraft=Draft
BillShortStatusPaid=Paid
-BillShortStatusPaidBackOrConverted=Credit note refund/converted
-BillShortStatusConverted=Processed
+BillShortStatusPaidBackOrConverted=Refund or converted
+BillShortStatusConverted=Paid
BillShortStatusCanceled=Abandoned
BillShortStatusValidated=Validated
BillShortStatusStarted=Started
@@ -273,12 +273,8 @@ CreditNotes=Credit notes
Deposit=Down payment
Deposits=Down payments
DiscountFromCreditNote=Discount from credit note %s
-<<<<<<< HEAD
-DiscountFromDeposit=Payments from deposit invoice %s
-DiscountFromExcessReceived=Payments from excess received of invoice %s
-=======
DiscountFromDeposit=Down payments from invoice %s
->>>>>>> branch '5.0' of git@github.com:Dolibarr/dolibarr.git
+DiscountFromExcessReceived=Payments from excess received of invoice %s
AbsoluteDiscountUse=This kind of credit can be used on invoice before its validation
CreditNoteDepositUse=Invoice must be validated to use this kind of credits
NewGlobalDiscount=New absolute discount
@@ -437,11 +433,7 @@ ChequeDeposits=Checks deposits
Cheques=Checks
DepositId=Id deposit
NbCheque=Number of checks
-<<<<<<< HEAD
CreditNoteConvertedIntoDiscount=This %s has been converted into %s
-=======
-CreditNoteConvertedIntoDiscount=This credit note or down payment invoice has been converted into %s
->>>>>>> branch '5.0' of git@github.com:Dolibarr/dolibarr.git
UsBillingContactAsIncoiveRecipientIfExist=Use customer billing contact address instead of third party address as recipient for invoices
ShowUnpaidAll=Show all unpaid invoices
ShowUnpaidLateOnly=Show late unpaid invoices only
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index eed25cde0c8..2350a90fe88 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -185,6 +185,7 @@ ErrorTaskAlreadyAssigned=Task already assigned to user
ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format.
ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (%s) does not match expected name syntax: %s
ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s.
+ErrorNoWarehouseDefined=Error, no warehouses defined.
# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index e546965d60d..18f42982ca8 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -79,6 +79,10 @@ MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters
MailingModuleDescContactsByCompanyCategory=Contacts by third party category
MailingModuleDescContactsByCategory=Contacts by categories
MailingModuleDescContactsByFunction=Contacts by position
+MailingModuleDescEmailsFromFile=Emails from file
+MailingModuleDescEmailsFromUser=Emails input by user
+MailingModuleDescDolibarrUsers=Users with Emails
+MailingModuleDescThirdPartiesByCategories=Third parties (by categories)
# Libelle des modules de liste de destinataires mailing
LineInFile=Line %s in file
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index cc407b9f054..92961b9a7d1 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -278,7 +278,7 @@ if ($action == 'create')
}
// Capital
- print '