diff --git a/ChangeLog b/ChangeLog
index fffd210862c..4a88f51c07d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -107,12 +107,35 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
+Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin.
+Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order.
+Fix: The object deliverycompany was not used anymore and output of
+ details for delivery reports was lost during 3.5. Rewrite code to
+ restore feature.
+Fix: [ bug #1445 ] html fix : missing
Fix: [ bug #1415 ] Intervention document model name and suppliers model names is not shown
properly in module configuration
Fix: [ bug #1416 ] Supplier order does not list document models in the select box of the
supplier order card
Fix: [ bug #1443 ] Payment conditions is erased after editing supplier invoice label or
limit date for payment
+Fix: Filter on status was not visible when selected from url.
+Fix: Filtering on status was last when asking to sort.
+Fix: [ bug #1432 ] Trigger SHIPPING_CREATE ignores interception on error.
+Fix: [ bug #1449 ] Trigger ORDER_CREATE, LINEORDER_DELETE, LINEORDER_UPDATE and LINEORDER_INSERT ignore interception on error.
+Fix: [ bug #1450 ] Several Customer order's triggers do not report the error from the trigger handler.
+Fix: [ bug #1451 ] Interrupted order clone through trigger, loads nonexistent order.
+Fix: [ bug #1454 ] Mention de bas de page erroné
+Fix: Do not display dictionnay for non activated module
+Fix: Link element from element project pages
+Fix: [ bug #1509 ] Expedition admin free text & watermark submit error
+Fix: [ bug #1349 ] AJAX contact selector does not work fine in Project card
+Fix: [ bug #1452 ] variable used but not defined
+Fix: If multiprice level is used the VAT on addline is not correct
+Fix: [ bug #1254 ] Error when using "Enter" on qty input box of a product (on supplier order part)
+Fix: [ bug #1462, 1468, 1480, 1483, 1490, 1497] $this instead of $object
+Fix: [ bug #1455 ] outstanding amount
+Fix: [ bug #1425 ]
***** ChangeLog for 3.5.3 compared to 3.5.2 *****
Fix: Error on field accountancy code for export profile of invoices.
diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php
index 398f17c13c4..d89b406280b 100644
--- a/htdocs/admin/expedition.php
+++ b/htdocs/admin/expedition.php
@@ -76,7 +76,7 @@ else if ($action == 'set_SHIPPING_FREE_TEXT')
$freetext=GETPOST('SHIPPING_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
- if ($res < 0)
+ if ($res > 0)
setEventMessage($langs->trans("SetupSaved"));
else
setEventMessage($langs->trans("Error"), 'errors');
@@ -87,7 +87,7 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
$draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
- if ($res < 0)
+ if ($res > 0)
setEventMessage($langs->trans("SetupSaved"));
else
setEventMessage($langs->trans("Error"), 'errors');
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index a9ec591cf5f..63220ce415e 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -178,7 +178,8 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
}
} else {
$langs->load("errors");
- setEventMessage($langs->trans($object->error), 'errors');
+ if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
+ else setEventMessage($langs->trans($object->error), 'errors');
}
}
@@ -472,7 +473,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$interface = new Interfaces($db);
$result = $interface->run_triggers('PROPAL_SENTBYMAIL', $object, $user, $langs, $conf);
if ($result < 0) {
- $error ++;
+ $error++;
$object->errors = $interface->errors;
}
// Fin appel triggers
@@ -609,12 +610,17 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
$tva_npr = get_default_npr($mysoc, $object->client, $prod->id);
// On defini prix unitaire
- if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) {
+ if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level)
+ {
$pu_ht = $prod->multiprices [$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level];
- } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
+ $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
+ $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
+ }
+ elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
+ {
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
@@ -631,7 +637,9 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
}
}
- } else {
+ }
+ else
+ {
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index e2b0f5506fb..c70e8b9e883 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -453,8 +453,13 @@ class Commande extends CommonOrder
}
else
{
- $this->db->rollback();
- return -1;
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::set_reopen ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
}
}
@@ -580,8 +585,14 @@ class Commande extends CommonOrder
else
{
$this->error=$mouvP->error;
+
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::cancel ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
$this->db->rollback();
- return -1;
+ return -1*$error;
}
}
else
@@ -808,8 +819,19 @@ class Commande extends CommonOrder
// Fin appel triggers
}
- $this->db->commit();
- return $this->id;
+ if (!$error) {
+ $this->db->commit();
+ return $this->id;
+ }
+
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
+
}
else
{
@@ -1795,7 +1817,7 @@ class Commande extends CommonOrder
else
{
$this->db->rollback();
- $this->error=$this->db->lasterror();
+ $this->error=$line->error;
return -1;
}
}
@@ -2229,9 +2251,14 @@ class Commande extends CommonOrder
else
{
$this->error=$this->db->error();
- dol_syslog(get_class($this)."::classifyBilled ".$this->error, LOG_ERR);
+
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
$this->db->rollback();
- return -2;
+ return -1*$error;
}
}
else
@@ -2397,11 +2424,10 @@ class Commande extends CommonOrder
}
else
{
- $this->error=$this->db->lasterror();
- $this->errors=array($this->db->lasterror());
- $this->db->rollback();
- dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR);
- return -1;
+ $this->error=$this->line->error;
+
+ $this->db->rollback();
+ return -1;
}
}
else
@@ -2519,9 +2545,13 @@ class Commande extends CommonOrder
else
{
$this->error=$this->db->lasterror();
- dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
- $this->db->rollback();
- return -1;
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
}
}
@@ -3154,6 +3184,8 @@ class OrderLine extends CommonOrderLine
$error=0;
+ $this->db->begin();
+
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";
dol_syslog("OrderLine::delete sql=".$sql);
@@ -3179,7 +3211,18 @@ class OrderLine extends CommonOrderLine
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
- return 1;
+ if (!$error) {
+ $this->db->commit();
+ return 1;
+ }
+
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
}
else
{
@@ -3295,8 +3338,18 @@ class OrderLine extends CommonOrderLine
// Fin appel triggers
}
- $this->db->commit();
- return 1;
+ if (!$error) {
+ $this->db->commit();
+ return 1;
+ }
+
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
}
else
{
@@ -3403,8 +3456,18 @@ class OrderLine extends CommonOrderLine
// Fin appel triggers
}
- $this->db->commit();
- return 1;
+ if (!$error) {
+ $this->db->commit();
+ return 1;
+ }
+
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
}
else
{
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 7c1f0d30d25..172fa7e3eae 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -104,18 +104,30 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
// Action clone object
-if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer) {
- if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) {
- $mesg = '
' . $langs->trans("NoCloneOptionsSpecified") . '
';
- } else {
- if ($object->id > 0) {
- $result = $object->createFromClone($socid);
- if ($result > 0) {
- header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
- exit();
- } else {
- $mesg = '' . $object->error . '
';
- $action = '';
+if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
+{
+ if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
+ {
+ $mesg=''.$langs->trans("NoCloneOptionsSpecified").'
';
+ }
+ else
+ {
+ if ($object->id > 0)
+ {
+ // Because createFromClone modifies the object, we must clone it so that we can restore it later
+ $orig = dol_clone($object);
+
+ $result=$object->createFromClone($socid);
+ if ($result > 0)
+ {
+ header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
+ exit;
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
+ $object = $orig;
+ $action='';
}
}
}
@@ -125,11 +137,14 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->
else if ($action == 'reopen' && $user->rights->commande->creer) {
if ($object->statut == 3) {
$result = $object->set_reopen($user);
- if ($result > 0) {
- header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
- exit();
- } else {
- $mesg = '' . $object->error . '
';
+ if ($result > 0)
+ {
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
+ exit;
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
}
}
}
@@ -139,9 +154,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->comm
$result = $object->delete($user);
if ($result > 0) {
header('Location: index.php');
- exit();
- } else {
- $mesg = '' . $object->error . '
';
+ exit;
+ }
+ else {
+ setEventMessage($object->error, 'errors');
}
}
@@ -165,10 +181,12 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
- header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
- exit();
- } else {
- $mesg = '' . $object->error . '
';
+ header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
+ exit;
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
}
}
@@ -382,8 +400,13 @@ else if ($action == 'add' && $user->rights->commande->creer) {
}
}
-else if ($action == 'classifybilled' && $user->rights->commande->creer) {
- $ret = $object->classifyBilled();
+else if ($action == 'classifybilled' && $user->rights->commande->creer)
+{
+ $ret=$object->classifyBilled();
+
+ if ($ret < 0) {
+ setEventMessage($object->error, 'errors');
+ }
}
// Positionne ref commande client
@@ -552,12 +575,17 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
$tva_npr = get_default_npr($mysoc, $object->client, $prod->id);
// multiprix
- if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) {
+ if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level))
+ {
$pu_ht = $prod->multiprices [$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level];
- } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
+ $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
+ $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
+ }
+ elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
+ {
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
@@ -574,7 +602,9 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
}
}
- } else {
+ }
+ else
+ {
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
@@ -898,8 +928,9 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
$result = $object->cloture($user);
- if ($result < 0)
- $mesgs = $object->errors;
+ if ($result < 0) {
+ setEventMessage($object->error, 'errors');
+ }
}
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) {
@@ -916,6 +947,10 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
if (! $error) {
$result = $object->cancel($idwarehouse);
+
+ if ($result < 0) {
+ setEventMessage($object->error, 'errors');
+ }
}
}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index b6837d68a98..b22f1c9827e 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1137,12 +1137,17 @@ else if ($action == 'addline' && $user->rights->facture->creer)
$tva_npr = get_default_npr($mysoc, $object->client, $prod->id);
// We define price for product
- if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) {
+ if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level))
+ {
$pu_ht = $prod->multiprices [$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level];
- } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
+ $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
+ $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
+ }
+ elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
+ {
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
@@ -1159,7 +1164,9 @@ else if ($action == 'addline' && $user->rights->facture->creer)
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
}
}
- } else {
+ }
+ else
+ {
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
@@ -1606,7 +1613,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface = new Interfaces($db);
$result = $interface->run_triggers('BILL_SENTBYMAIL', $object, $user, $langs, $conf);
if ($result < 0) {
- $error ++;
+ $error++;
$object->errors = $interface->errors;
}
// Fin appel triggers
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index fcf53d8254c..bc2a7120515 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -616,7 +616,7 @@ class FormFile
}
}
- if (count($file_list) == 0)
+ if (count($file_list) == 0 && $headershown)
{
$out.='| '.$langs->trans("None").' |
';
}
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 2c371d4afcd..b3228278261 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -77,7 +77,7 @@ class FormProjets
$sql.= " WHERE p.entity = ".$conf->entity;
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
- $sql.= " ORDER BY p.title ASC";
+ $sql.= " ORDER BY p.ref ASC";
dol_syslog(get_class($this)."::select_projects sql=".$sql,LOG_DEBUG);
$resql=$this->db->query($sql);
@@ -113,6 +113,7 @@ class FormProjets
else
{
$disabled=0;
+ $labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
if (! $obj->fk_statut > 0)
{
$disabled=1;
@@ -134,8 +135,8 @@ class FormProjets
if ($disabled) $resultat.=' disabled="disabled"';
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
- $resultat.='>'.$labeltoshow;
- if (! $disabled) $resultat.=' - '.dol_trunc($obj->title,$maxlength);
+ $resultat.='>';
+ $resultat.=$labeltoshow;
$resultat.='';
}
$out.= $resultat;
@@ -167,6 +168,7 @@ class FormProjets
*/
function select_element($table_element)
{
+ global $conf;
$projectkey="fk_projet";
switch ($table_element)
@@ -194,7 +196,7 @@ class FormProjets
if (!empty($this->societe->id)) {
$sql.= " AND fk_soc=".$this->societe->id;
}
- $sql.= ' AND entity='.$conf->entity;
+ $sql.= ' AND entity='.getEntity('project');
$sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG);
@@ -218,6 +220,10 @@ class FormProjets
return $sellist ;
$this->db->free($resql);
+ }else {
+ $this->error=$this->db->lasterror();
+ dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR);
+ return -1;
}
}
diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js
index 0223117ec50..a5e1410d503 100644
--- a/htdocs/core/js/lib_head.js
+++ b/htdocs/core/js/lib_head.js
@@ -810,6 +810,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
var input = this.input = $( "" )
.insertAfter( select )
.val( value )
+ .attr('id', 'inputautocomplete'+select.attr('id'))
.autocomplete({
delay: 0,
minLength: this.options.minLengthToAutocomplete,
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 2f5e217641f..19441e507aa 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -937,6 +937,8 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
+ //If module is not activated disqualified
+ if (empty($conf->global->$const_name)) $modulequalified=0;
if ($modulequalified)
{
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index 55815324487..f36dc59c43a 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -368,6 +368,13 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
}
});
$("select#" + htmlname).html(response.value);
+ if (response.num) {
+ var selecthtml_str = response.value;
+ var selecthtml_dom=$.parseHTML(selecthtml_str);
+ $("#inputautocomplete"+htmlname).val(selecthtml_dom[0][0].innerHTML);
+ } else {
+ $("#inputautocomplete"+htmlname).val("");
+ }
});
}
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 614c55305fc..c1dde592ab6 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -348,7 +348,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
// Phone
if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
- if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= " / ";
+ if (! empty($targetcontact->phone_pro) && ! empty($targetcontact->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
// Fax
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
@@ -369,7 +369,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
// Phone
if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
- if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= " / ";
+ if (! empty($targetcompany->phone) && ! empty($targetcompany->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile);
// Fax
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
index 8e158037f8a..5385d7ad0e6 100644
--- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
@@ -604,7 +604,6 @@ class pdf_merou extends ModelePdfExpedition
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails');
-
$blDestX=$blExpX+55;
$blW=50;
$Yoff = $Ydef +1;
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 648156e5bef..fe952fb9903 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -630,7 +630,7 @@ class pdf_azur extends ModelePDFPropales
$posxval=52;
// Show shipping date
- if ($object->date_livraison)
+ if (! empty($object->date_livraison))
{
$outputlangs->load("sendings");
$pdf->SetFont('','B', $default_font_size - 2);
diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 63b301253ab..f15cab9cb6b 100644
--- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -911,6 +911,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$outputlangs->load("bills");
$outputlangs->load("orders");
$outputlangs->load("companies");
+ $outputlangs->load("sendings");
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -981,11 +982,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$posy+=5;
$pdf->SetXY($posx,$posy);
- if ($object->date_commande)
+ if (! empty($object->date_commande))
{
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R');
- $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R');
}
else
{
@@ -993,6 +993,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R');
}
+ $pdf->SetTextColor(0,0,60);
+ if (! empty($object->date_livraison)) $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R');
+
$posy+=5;
$pdf->SetTextColor(0,0,60);
@@ -1094,7 +1097,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
*/
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
{
- return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
+ return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index b7a94bc28c4..93c7f63b4ad 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -282,8 +282,22 @@ class Expedition extends CommonObject
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
- $this->db->commit();
- return $this->id;
+ if (! $error)
+ {
+ $this->db->commit();
+ return $this->id;
+ }
+ else
+ {
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
+ }
+
}
else
{
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 22df11dd7ae..286c3d45301 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -1860,8 +1860,6 @@ elseif (! empty($object->id))
print '';
- //print '
| ';
- //print ''; // ancre
/*
* Documents generes
@@ -1890,10 +1888,6 @@ elseif (! empty($object->id))
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'order_supplier',$socid);
- print '';
-
- //print ' | ';
- print '';
if ($user->rights->fournisseur->commande->commander && $object->statut == 2)
{
@@ -1962,7 +1956,6 @@ elseif (! empty($object->id))
*/
print ' ';
- //print ' |
';
}
/*
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 46932f5de97..b2f803d5d2a 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -1197,10 +1197,10 @@ if ($action == 'create')
{
print $form->select_company((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1',1);
}
- print '';
+ print '';
// Ref supplier
- print '
| '.$langs->trans('RefSupplier').' | | ';
+ print '
| '.$langs->trans('RefSupplier').' | | ';
print '
';
print '
| '.$langs->trans('Type').' | ';
@@ -1287,7 +1287,7 @@ if ($action == 'create')
print ' |
';
// Label
- print '
| '.$langs->trans('Label').' | |
';
+ print '
| '.$langs->trans('Label').' | |
';
// Date invoice
print '
| '.$langs->trans('DateInvoice').' | ';
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 1f75abf0915..673ac3fea6f 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -119,7 +119,7 @@ if ($socid)
{
$sql .= " AND s.rowid = ".$socid;
}
-if (GETPOST('filtre'))
+if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a string
{
$filtrearr = explode(",", GETPOST('filtre'));
foreach ($filtrearr as $fil)
@@ -191,15 +191,16 @@ if ($resql)
$soc->fetch($socid);
}
- $param='&socid='.$socid;
- if ($month) $param.='&month='.urlencode($month);
- if ($year) $param.='&year=' .urlencode($year);
- if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref"));
- if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier"));
- if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle"));
- if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe"));
- if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht"));
- if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc"));
+ $param='&socid='.$socid;
+ if ($month) $param.='&month='.urlencode($month);
+ if ($year) $param.='&year=' .urlencode($year);
+ if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref"));
+ if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier"));
+ if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle"));
+ if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe"));
+ if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht"));
+ if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc"));
+ if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre"));
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->nom":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print ' | ';
print '';
- print ' | ';
+ print ' | ';
+ $liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed"));
+ print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1);
print '';
print ' | ';
print "
\n";
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 0a56b5253a9..697d773f02c 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -852,7 +852,7 @@ class Task extends CommonObject
$this->id = $obj->fk_task;
$this->timespent_date = $obj->task_date;
$this->timespent_duration = $obj->task_duration;
- $this->timespent_user = $obj->fk_user;
+ $this->timespent_fk_user = $obj->fk_user;
$this->timespent_note = $obj->note;
}
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 322820b361d..6101f337471 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -222,13 +222,18 @@ foreach ($listofreferent as $key => $value)
$classname=$value['class'];
$tablename=$value['table'];
$qualified=$value['test'];
+
if ($qualified)
{
print '
';
print_titre($langs->trans($title));
-
+
$selectList=$formproject->select_element($tablename);
+ if ($selectList<0) {
+ setEventMessage($formproject->error,'errors');
+ }
+
if ($selectList)
{
print '