diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php
index 8acd2588831..50e0dae56d2 100644
--- a/htdocs/fourn/commande/contact.php
+++ b/htdocs/fourn/commande/contact.php
@@ -44,8 +44,7 @@ $result = restrictedArea($user, 'commande_fournisseur', $id,'');
/*
* Ajout d'un nouveau contact
*/
-
-if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer)
+if ($_POST["action"] == 'addcontact' && $user->rights->fournisseur->commande->creer)
{
$result = 0;
@@ -76,7 +75,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer)
}
}
// modification d'un contact. On enregistre le type
-if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer)
+if ($_POST["action"] == 'updateligne' && $user->rights->fournisseur->commande->creer)
{
$commande = new CommandeFournisseur($db);
if ($commande->fetch($_GET["id"]))
@@ -101,7 +100,7 @@ if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer)
}
// bascule du statut d'un contact
-if ($_GET["action"] == 'swapstatut' && $user->rights->commande->creer)
+if ($_GET["action"] == 'swapstatut' && $user->rights->fournisseur->commande->creer)
{
$commande = new CommandeFournisseur($db);
if ($commande->fetch($_GET["id"]))
@@ -126,7 +125,7 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->commande->creer)
}
// Efface un contact
-if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
+if ($_GET["action"] == 'deleteline' && $user->rights->fournisseur->commande->creer)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]);
@@ -267,7 +266,7 @@ if ($id > 0 || ! empty($ref))
print '';
print '
';
- $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id;
+ $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$soc->id;
$selectedCompany = $formcompany->selectCompaniesForNewContact($commande, 'id', $selectedCompany, 'newcompany');
print ' | ';
@@ -367,7 +366,7 @@ if ($id > 0 || ! empty($ref))
// Icon update et delete
print '';
- if ($commande->statut < 5 && $user->rights->commande->creer)
+ if ($commande->statut < 5 && $user->rights->fournisseur->commande->creer)
{
print ' ';
print '';
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 09935f1fe47..422742fd164 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -310,21 +310,36 @@ if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer && $
}
}
-if ($action == 'confirm_deleteproductline' && $confirm == 'yes')
+if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer)
{
- if ($user->rights->fournisseur->commande->creer)
- {
- $object->fetch($id);
- $result = $object->deleteline($_GET['lineid']);
+ $object->fetch($id);
- $outputlangs = $langs;
- if (! empty($_REQUEST['lang_id']))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($_REQUEST['lang_id']);
- }
- supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
- }
+ $result = $object->deleteline(GETPOST('lineid'));
+ if ($result >= 0)
+ {
+ $outputlangs = $langs;
+ if (! empty($_REQUEST['lang_id']))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ }
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ {
+ $ret=$object->fetch($id); // Reload to get new records
+ supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
+ }
+ }
+ else
+ {
+ $error++;
+ $mesg=$object->error;
+ }
+
+ if (! $error)
+ {
+ Header("Location: fiche.php?id=".$id);
+ exit;
+ }
}
if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider)
diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
index d856f6eb4d8..e9579775a61 100644
--- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -739,6 +739,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Cadre client destinataire
$pdf->rect(100, $posy, 100, $hautcadre);
+
+ $usecontact=false;
+ $arrayidcontact=$object->getIdContact('external','BILLING');
+ if (sizeof($arrayidcontact) > 0)
+ {
+ $usecontact=true;
+ $result=$object->fetch_contact($arrayidcontact[0]);
+ }
// Recipient name
if (! empty($usecontact))
diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php
index 26a4a47a7a6..adb16ebda79 100644
--- a/htdocs/user/perms.php
+++ b/htdocs/user/perms.php
@@ -149,7 +149,7 @@ foreach ($conf->file->dol_document_root as $type => $dirroot)
foreach($modulesdir as $dir)
{
- $handle=opendir($dir);
+ $handle=@opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
|