Correction bug #18853

This commit is contained in:
Rodolphe Quiedeville 2007-01-24 10:49:56 +00:00
parent 2f4137934f
commit c09d353a7a

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
@ -25,9 +25,9 @@
*/ */
/** /**
\file htdocs/comm/propal.php \file htdocs/comm/propal.php
\ingroup propale \ingroup propale
\brief Page liste des propales (vision commercial) \brief Page liste des propales (vision commercial)
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -62,8 +62,8 @@ $socid='';
if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($_GET["socid"]) { $socid=$_GET["socid"]; }
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
// Nombre de ligne pour choix de produit/service prédéfinis // Nombre de ligne pour choix de produit/service prédéfinis
@ -71,42 +71,40 @@ $NBLINES=4;
$form=new Form($db); $form=new Form($db);
/******************************************************************************/ /******************************************************************************/
/* Actions */ /* Actions */
/******************************************************************************/ /******************************************************************************/
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
{ {
if ($user->rights->propale->supprimer) if ($user->rights->propale->supprimer)
{ {
$propal = new Propal($db, 0, $_GET['propalid']); $propal = new Propal($db, 0, $_GET['propalid']);
$propal->fetch($_GET['propalid']); $propal->fetch($_GET['propalid']);
$propal->delete($user); $propal->delete($user);
$propalid = 0; $propalid = 0;
$brouillon = 1; $brouillon = 1;
} }
Header('Location: '.$_SERVER["PHP_SELF"]); Header('Location: '.$_SERVER["PHP_SELF"]);
exit; exit;
} }
if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{ {
if ($user->rights->propale->creer) if ($user->rights->propale->creer)
{ {
$propal = new Propal($db); $propal = new Propal($db);
$propal->fetch($_GET['propalid']); $propal->fetch($_GET['propalid']);
$result=$propal->delete_product($_GET['ligne']); $result=$propal->delete_product($_GET['ligne']);
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
{ {
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
} }
Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']); Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']);
exit; exit;
} }
if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes') if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes')
@ -703,11 +701,6 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
exit; exit;
} }
llxHeader('',$langs->trans('Proposal'),'Proposition');
$html = new Form($db); $html = new Form($db);
/* /*
@ -716,92 +709,97 @@ $html = new Form($db);
*/ */
if ($_GET['propalid'] > 0) if ($_GET['propalid'] > 0)
{ {
if ($mesg) print "$mesg<br>"; if ($mesg) print "$mesg<br>";
$propal = new Propal($db); $propal = new Propal($db);
$result=$propal->fetch($_GET['propalid']); $result=$propal->fetch($_GET['propalid']);
if (! $result > 0) if (! $result > 0)
{ {
dolibarr_print_error($db,$propal->error); dolibarr_print_error($db,$propal->error);
exit; exit;
} }
$societe = new Societe($db); if ($user->societe_id > 0 && $propal->socid <> $user->societe_id)
$societe->fetch($propal->socid); accessforbidden();
$head = propal_prepare_head($propal); llxHeader('',$langs->trans('Proposal'),'Proposition');
dolibarr_fiche_head($head, 'comm', $langs->trans('Proposal'));
$societe = new Societe($db);
$societe->fetch($propal->socid);
$head = propal_prepare_head($propal);
dolibarr_fiche_head($head, 'comm', $langs->trans('Proposal'));
/* /*
* Confirmation de la suppression de la propale * Confirmation de la suppression de la propale
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete');
print '<br>'; print '<br>';
} }
/* /*
* Confirmation de la suppression d'une ligne produit * Confirmation de la suppression d'une ligne produit
*/ */
if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{ {
$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;ligne='.$_GET["ligne"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&amp;ligne='.$_GET["ligne"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline');
print '<br>'; print '<br>';
} }
/* /*
* Confirmation de la validation de la propale * Confirmation de la validation de la propale
*/ */
if ($_GET['action'] == 'validate') if ($_GET['action'] == 'validate')
{ {
$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate'); $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate');
print '<br>'; print '<br>';
} }
/* /*
* Fiche propal * Fiche propal
* *
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">'.$propal->ref_url.'</td></tr>'; print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">'.$propal->ref_url.'</td></tr>';
// Ref client // Ref client
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>'; print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
print $langs->trans('RefCustomer').'</td><td align="left">'; print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>'; print '</td>';
if ($_GET['action'] != 'refclient' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&amp;propalid='.$propal->id.'">'.img_edit($langs->trans('Edit')).'</a></td>'; if ($_GET['action'] != 'refclient' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&amp;propalid='.$propal->id.'">'.img_edit($langs->trans('Edit')).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="5">'; print '</td><td colspan="5">';
if ($user->rights->propale->creer && $_GET['action'] == 'refclient') if ($user->rights->propale->creer && $_GET['action'] == 'refclient')
{ {
print '<form action="propal.php?propalid='.$propal->id.'" method="post">'; print '<form action="propal.php?propalid='.$propal->id.'" method="post">';
print '<input type="hidden" name="action" value="set_ref_client">'; print '<input type="hidden" name="action" value="set_ref_client">';
print '<input type="text" class="flat" size="20" name="ref_client" value="'.$propal->ref_client.'">'; print '<input type="text" class="flat" size="20" name="ref_client" value="'.$propal->ref_client.'">';
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">'; print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} }
else else
{ {
print $propal->ref_client; print $propal->ref_client;
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$rowspan=8; $rowspan=8;
// Société // Société
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td>';
print '</tr>'; print '</tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client); if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
@ -828,11 +826,11 @@ if ($_GET['propalid'] > 0)
print '</td>'; print '</td>';
if ($conf->projet->enabled) $rowspan++; if ($conf->projet->enabled) $rowspan++;
if ($conf->expedition->enabled) if ($conf->expedition->enabled)
{ {
if ($conf->global->PROPALE_ADD_SHIPPING_DATE) $rowspan++; if ($conf->global->PROPALE_ADD_SHIPPING_DATE) $rowspan++;
if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) $rowspan++; if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) $rowspan++;
} }
// Notes // Notes
print '<td valign="top" colspan="2" width="50%" rowspan="'.$rowspan.'">'.$langs->trans('NotePublic').' :<br>'. nl2br($propal->note_public).'</td>'; print '<td valign="top" colspan="2" width="50%" rowspan="'.$rowspan.'">'.$langs->trans('NotePublic').' :<br>'. nl2br($propal->note_public).'</td>';
@ -1720,6 +1718,8 @@ if ($conf->expedition->enabled)
} }
else else
{ {
llxHeader('',$langs->trans('Proposal'),'Proposition');
/**************************************************************************** /****************************************************************************
* * * *
* Mode Liste des propales * * Mode Liste des propales *