Merge branch '3.1' of ssh://git@github.com/Dolibarr/dolibarr.git into 3.1

This commit is contained in:
Laurent Destailleur 2012-01-11 02:01:41 +01:00
commit bc9a31dc96
4 changed files with 43 additions and 21 deletions

View File

@ -44,8 +44,7 @@ $result = restrictedArea($user, 'commande_fournisseur', $id,'');
/* /*
* Ajout d'un nouveau contact * Ajout d'un nouveau contact
*/ */
if ($_POST["action"] == 'addcontact' && $user->rights->fournisseur->commande->creer)
if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer)
{ {
$result = 0; $result = 0;
@ -76,7 +75,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer)
} }
} }
// modification d'un contact. On enregistre le type // 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); $commande = new CommandeFournisseur($db);
if ($commande->fetch($_GET["id"])) if ($commande->fetch($_GET["id"]))
@ -101,7 +100,7 @@ if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer)
} }
// bascule du statut d'un contact // 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); $commande = new CommandeFournisseur($db);
if ($commande->fetch($_GET["id"])) if ($commande->fetch($_GET["id"]))
@ -126,7 +125,7 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->commande->creer)
} }
// Efface un contact // 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 = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]); $commande->fetch($_GET["id"]);
@ -267,7 +266,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id; $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$soc->id;
$selectedCompany = $formcompany->selectCompaniesForNewContact($commande, 'id', $selectedCompany, 'newcompany'); $selectedCompany = $formcompany->selectCompaniesForNewContact($commande, 'id', $selectedCompany, 'newcompany');
print '</td>'; print '</td>';
@ -367,7 +366,7 @@ if ($id > 0 || ! empty($ref))
// Icon update et delete // Icon update et delete
print '<td align="center" nowrap>'; print '<td align="center" nowrap>';
if ($commande->statut < 5 && $user->rights->commande->creer) if ($commande->statut < 5 && $user->rights->fournisseur->commande->creer)
{ {
print '&nbsp;'; print '&nbsp;';
print '<a href="contact.php?id='.$commande->id.'&amp;action=deleteline&amp;lineid='.$tab[$i]['rowid'].'">'; print '<a href="contact.php?id='.$commande->id.'&amp;action=deleteline&amp;lineid='.$tab[$i]['rowid'].'">';

View File

@ -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);
{
$object->fetch($id);
$result = $object->deleteline($_GET['lineid']);
$outputlangs = $langs; $result = $object->deleteline(GETPOST('lineid'));
if (! empty($_REQUEST['lang_id'])) if ($result >= 0)
{ {
$outputlangs = new Translate("",$conf); $outputlangs = $langs;
$outputlangs->setDefaultLang($_REQUEST['lang_id']); if (! empty($_REQUEST['lang_id']))
} {
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref')); $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) if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider)

View File

@ -739,6 +739,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Cadre client destinataire // Cadre client destinataire
$pdf->rect(100, $posy, 100, $hautcadre); $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 // Recipient name
if (! empty($usecontact)) if (! empty($usecontact))

View File

@ -149,7 +149,7 @@ foreach ($conf->file->dol_document_root as $type => $dirroot)
foreach($modulesdir as $dir) foreach($modulesdir as $dir)
{ {
$handle=opendir($dir); $handle=@opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)