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
*/
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 '</td>';
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');
print '</td>';
@ -367,7 +366,7 @@ if ($id > 0 || ! empty($ref))
// Icon update et delete
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 '<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);
$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)

View File

@ -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))

View File

@ -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)