diff --git a/ChangeLog b/ChangeLog
index 3801a03e69b..9c9c2b8a039 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -153,6 +153,9 @@ Dolibarr better:
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice
- Fix: bug 1588 : relative discount
- Fix: label of input method not tranlated.
+- Fix: box of customer and propsects were not correctly disabled.
+- Fix: right and error management #1961
+- Fix: Fix Error when trying to clone an Order #1943
***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users:
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 25c8a1d11c3..6db8af5c2db 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -898,6 +898,13 @@ class Commande extends CommonOrder
$this->date_validation = '';
$this->ref_client = '';
+ // Set ref
+ require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$conf->global->COMMANDE_ADDON.'.php';
+ $obj = $conf->global->COMMANDE_ADDON;
+ $modCommande = new $obj;
+ $this->ref = $modCommande->getNextValue($objsoc,$this);
+
+
// Create clone
$result=$this->create($user);
if ($result < 0) $error++;
diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php
index 374851ca749..dd6455a3932 100644
--- a/htdocs/compta/charges/index.php
+++ b/htdocs/compta/charges/index.php
@@ -112,7 +112,7 @@ if ($conf->salaries->enabled)
$total = 0 ;
print '
';
print '';
- print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
@@ -145,7 +145,7 @@ if ($conf->salaries->enabled)
$i++;
}
- print '
| '.$langs->trans("Total").' | ';
+ print '
| '.$langs->trans("Total").' | ';
print ''.price($total)." | ";
print ' | ';
print ' | ';
@@ -175,7 +175,7 @@ if ($conf->tax->enabled)
print '';
print '';
- print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
@@ -305,7 +305,7 @@ if ($conf->tax->enabled)
$total = 0 ;
print '';
print '';
- print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
@@ -338,7 +338,7 @@ if ($conf->tax->enabled)
$i++;
}
- print '
| '.$langs->trans("Total").' | ';
+ print '
| '.$langs->trans("Total").' | ';
print ''.price($total)." | ";
print ' | ';
print ' | ';
diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php
index 9e1706a5e6b..4e651e8bdcc 100644
--- a/htdocs/core/boxes/box_clients.php
+++ b/htdocs/core/boxes/box_clients.php
@@ -37,12 +37,28 @@ class box_clients extends ModeleBoxes
var $depends = array("societe");
var $db;
- var $param;
+ var $enabled = 1;
var $info_box_head = array();
var $info_box_contents = array();
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ function __construct($db,$param='')
+ {
+ global $conf, $user;
+
+ $this->db = $db;
+
+ // disable box for such cases
+ if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
+ }
+
/**
* Load data for box to show them later
*
diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php
index dd8682515c7..3020f12f0c4 100644
--- a/htdocs/core/boxes/box_prospect.php
+++ b/htdocs/core/boxes/box_prospect.php
@@ -39,11 +39,28 @@ class box_prospect extends ModeleBoxes
var $depends = array("societe");
var $db;
+ var $enabled = 1;
var $info_box_head = array();
var $info_box_contents = array();
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ function __construct($db,$param='')
+ {
+ global $conf, $user;
+
+ $this->db = $db;
+
+ // disable box for such cases
+ if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0; // disabled by this option
+ }
+
/**
* Load data into info_box_contents array to show array later.
*
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 5644e41df1c..8ec7c5b12a7 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -422,11 +422,10 @@ if (empty($reshook))
$_error++;
$action = "";
- $mesg='';
setEventMessage($mesg, 'errors');
- //dol_print_error($object->db);
+ $object->fetch($id);
}
else
{
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index ebcd3245e7d..3629f98365e 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -462,7 +462,7 @@ else
}
// Better buy price
- if ($user->rights->produit->creer)
+ if ($user->rights->fournisseur->lire)
{
print '';
if ($objp->minsellprice != '')
|