From c09d353a7a42b63075e702e29246c81daeb4285c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 24 Jan 2007 10:49:56 +0000 Subject: [PATCH] Correction bug #18853 --- htdocs/comm/propal.php | 248 ++++++++++++++++++++--------------------- 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c28781010ee..9a1eedbf2d7 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Marc Barilley / Ocebo @@ -25,9 +25,9 @@ */ /** - \file htdocs/comm/propal.php - \ingroup propale - \brief Page liste des propales (vision commercial) + \file htdocs/comm/propal.php + \ingroup propale + \brief Page liste des propales (vision commercial) */ require("./pre.inc.php"); @@ -62,8 +62,8 @@ $socid=''; if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } // Nombre de ligne pour choix de produit/service prédéfinis @@ -71,42 +71,40 @@ $NBLINES=4; $form=new Form($db); - - /******************************************************************************/ /* Actions */ /******************************************************************************/ 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->fetch($_GET['propalid']); - $propal->delete($user); - $propalid = 0; - $brouillon = 1; + $propal = new Propal($db, 0, $_GET['propalid']); + $propal->fetch($_GET['propalid']); + $propal->delete($user); + $propalid = 0; + $brouillon = 1; } - Header('Location: '.$_SERVER["PHP_SELF"]); - exit; + Header('Location: '.$_SERVER["PHP_SELF"]); + exit; } 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->fetch($_GET['propalid']); - $result=$propal->delete_product($_GET['ligne']); - if ($_REQUEST['lang_id']) - { - $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); - } - propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); + $propal = new Propal($db); + $propal->fetch($_GET['propalid']); + $result=$propal->delete_product($_GET['ligne']); + if ($_REQUEST['lang_id']) + { + $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); + } + propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); } - Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']); - exit; + Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']); + exit; } if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes') @@ -703,11 +701,6 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer) exit; } - - - -llxHeader('',$langs->trans('Proposal'),'Proposition'); - $html = new Form($db); /* @@ -716,92 +709,97 @@ $html = new Form($db); */ if ($_GET['propalid'] > 0) { - if ($mesg) print "$mesg
"; + if ($mesg) print "$mesg
"; + + $propal = new Propal($db); + + $result=$propal->fetch($_GET['propalid']); + if (! $result > 0) + { + dolibarr_print_error($db,$propal->error); + exit; + } - $propal = new Propal($db); + if ($user->societe_id > 0 && $propal->socid <> $user->societe_id) + accessforbidden(); - $result=$propal->fetch($_GET['propalid']); - if (! $result > 0) - { - dolibarr_print_error($db,$propal->error); - exit; - } - - $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 - */ - if ($_GET['action'] == 'delete') - { - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); - print '
'; - } - - /* - * Confirmation de la suppression d'une ligne produit - */ - if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) - { - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); - print '
'; - } - - /* - * Confirmation de la validation de la propale - */ - if ($_GET['action'] == 'validate') - { - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate'); - print '
'; - } - - - /* - * Fiche propal - * - */ - - print ''; - - // Ref - print ''; - - // Ref client - print ''; - print ''; - - $rowspan=8; - - // Société - print ''; - print ''; - - // Ligne info remises tiers + llxHeader('',$langs->trans('Proposal'),'Proposition'); + + $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 + */ + if ($_GET['action'] == 'delete') + { + $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); + print '
'; + } + + /* + * Confirmation de la suppression d'une ligne produit + */ + if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) + { + $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); + print '
'; + } + + /* + * Confirmation de la validation de la propale + */ + if ($_GET['action'] == 'validate') + { + $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate'); + print '
'; + } + + + /* + * Fiche propal + * + */ + + print '
'.$langs->trans('Ref').''.$propal->ref_url.'
'; - print ''; - if ($_GET['action'] != 'refclient' && $propal->brouillon) print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print ''.img_edit($langs->trans('Edit')).'
'; - print '
'; - if ($user->rights->propale->creer && $_GET['action'] == 'refclient') - { - print '
'; - print ''; - print ''; - print ' '; - print '
'; - } - else - { - print $propal->ref_client; - } - print '
'.$langs->trans('Company').''.$societe->getNomUrl(1).'
'; + + // Ref + print ''; + + // Ref client + print ''; + print ''; + + $rowspan=8; + + // Société + print ''; + print ''; + + // Ligne info remises tiers print ''; if ($conf->projet->enabled) $rowspan++; -if ($conf->expedition->enabled) -{ - if ($conf->global->PROPALE_ADD_SHIPPING_DATE) $rowspan++; - if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) $rowspan++; -} - + if ($conf->expedition->enabled) + { + if ($conf->global->PROPALE_ADD_SHIPPING_DATE) $rowspan++; + if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) $rowspan++; + } + // Notes print ''; print ''; @@ -1720,12 +1718,14 @@ if ($conf->expedition->enabled) } else { + llxHeader('',$langs->trans('Proposal'),'Proposition'); + /**************************************************************************** * * * Mode Liste des propales * * * ****************************************************************************/ - + $sortorder=$_GET['sortorder']; $sortfield=$_GET['sortfield']; $page=$_GET['page'];
'.$langs->trans('Ref').''.$propal->ref_url.'
'; + print ''; + if ($_GET['action'] != 'refclient' && $propal->brouillon) print ''; + print '
'; + print $langs->trans('RefCustomer').''; + print ''.img_edit($langs->trans('Edit')).'
'; + print '
'; + if ($user->rights->propale->creer && $_GET['action'] == 'refclient') + { + print '
'; + print ''; + print ''; + print ' '; + print '
'; + } + else + { + print $propal->ref_client; + } + print '
'.$langs->trans('Company').''.$societe->getNomUrl(1).'
'.$langs->trans('Discounts').''; if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client); else print $langs->trans("CompanyHasNoRelativeDiscount"); @@ -828,12 +826,12 @@ if ($_GET['propalid'] > 0) print ''.$langs->trans('NotePublic').' :
'. nl2br($propal->note_public).'