From da03f9a9515e59e8a7e68d9e1e4c0738934c0757 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 9 Jan 2012 17:52:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[bug=20#274]=20Article=20reste=20apr=C3=A8s?= =?UTF-8?q?=20suppression=20article?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/fourn/commande/fiche.php | 41 ++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) 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) From 7707182c598a9b93929892438ad342604f44badf Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 9 Jan 2012 18:00:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[bug=20#275]=20Ajout=20contacts=20-=20choix?= =?UTF-8?q?=20par=20"par=20d=C3=A9faut"=20de=20l'entreprise=20du=20fournis?= =?UTF-8?q?seur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/fourn/commande/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 8acd2588831..c64d317d08e 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -267,7 +267,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 ''; From a85a08cbd872c274efc9ae19de0ba510ce91171a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 9 Jan 2012 18:25:14 +0800 Subject: [PATCH 3/5] Fix: avoid warning --- htdocs/user/perms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From d4568f5605b722b6d5dc11494578516dc089ca2d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 9 Jan 2012 18:35:57 +0800 Subject: [PATCH 4/5] Fix: bad rights --- htdocs/fourn/commande/contact.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index c64d317d08e..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"]); @@ -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 ''; From fbe23ddb56c08a8faa5d1bcb158a29cfe0498d7e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 9 Jan 2012 18:36:20 +0800 Subject: [PATCH 5/5] [bug #276] Nom contact ne s'affiche pas sur pdf commande fournisseur (Muscadet) --- .../modules/supplier_order/pdf/pdf_muscadet.modules.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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))