diff --git a/htdocs/document.php b/htdocs/document.php index 9412dd18567..63a73b73bad 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -96,7 +96,7 @@ if ($modulepart) } $original_file=$conf->propal->dir_output.'/'.$original_file; } - // Wrapping pour les comandes + // Wrapping pour les commandes if ($modulepart == 'commande') { $user->getrights('commande'); @@ -106,6 +106,28 @@ if ($modulepart) } $original_file=$conf->commande->dir_output.'/'.$original_file; } + + // Wrapping pour les commandes fournisseurs + if ($modulepart == 'commande_fournisseur') + { + $user->getrights('fournisseur'); + if ($user->rights->fournisseur->commande->lire) + { + $accessallowed=1; + } + $original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file; + } + + // Wrapping pour les factures fournisseurs + if ($modulepart == 'facture_fournisseur') + { + $user->getrights('fournisseur'); + if ($user->rights->fournisseur->facture->lire) + { + $accessallowed=1; + } + $original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file; + } // Wrapping pour les rapport de paiements if ($modulepart == 'facture_paiement') diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 3f810bf8892..54bd3897228 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -31,6 +31,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/project.class.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); +require_once(DOL_DOCUMENT_ROOT ."/fourn/commande/modules/modules_commandefournisseur.php"); if (!$user->rights->fournisseur->commande->lire) accessforbidden(); @@ -204,6 +205,21 @@ if ($_POST["action"] == 'confirm_cancel' && $_POST["confirm"] == yes && $user->r exit; } + /* + * Generation de la commande + * définit dans /fourn/commande/modules/modules_commandefournisseur.php + */ +if ($_POST['action'] == 'builddoc') +{ + commande_supplier_pdf_create($db, $_GET['id'],$_POST['model']); +} +if($_GET['action'] == 'builddoc') +{ + $commande = new CommandeFournisseur($db); + $commande->fetch($_GET['id']); + commande_supplier_pdf_create($db, $_GET['id'],$commande->modelpdf); +} + /* * Créé une commande */ @@ -478,7 +494,7 @@ if ($_GET["id"] > 0) /* * Ajouter une ligne */ - if ($_GET["action"] <> 'valid' && $commande->statut == 0 && $user->rights->fournisseur->commande->creer) + if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc')) { print '