Fixed a minor bug with the BackToList link in a budget detail view reported in Dolibarr.es

You'll see a lot of lines changed because of incorrect line endings
This commit is contained in:
Marcos García 2012-07-20 21:25:29 +02:00
parent c3b18a1e38
commit f6fc21f5fb

View File

@ -1,153 +1,153 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/comm/propal/document.php * \file htdocs/comm/propal/document.php
* \ingroup propale * \ingroup propale
* \brief Page de gestion des documents attaches a une proposition commerciale * \brief Page de gestion des documents attaches a une proposition commerciale
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load('compta'); $langs->load('compta');
$langs->load('other'); $langs->load('other');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST('ref','alpha'); $ref = GETPOST('ref','alpha');
$mesg=''; $mesg='';
if (isset($_SESSION['DolMessage'])) if (isset($_SESSION['DolMessage']))
{ {
$mesg=$_SESSION['DolMessage']; $mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']); unset($_SESSION['DolMessage']);
} }
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
{ {
$action=''; $action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'propale', $id, 'propal'); $result = restrictedArea($user, 'propale', $id, 'propal');
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$object = new Propal($db); $object = new Propal($db);
$object->fetch($id,$ref); $object->fetch($id,$ref);
if ($object->id > 0) if ($object->id > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
} }
/* /*
* Actions * Actions
*/ */
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
if (dol_mkdir($upload_dir) >= 0) if (dol_mkdir($upload_dir) >= 0)
{ {
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0,0,$_FILES['userfile']['error']); $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
{ {
// Create small thumbs for image (Ratio is near 16/9) // Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example // Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9) // Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; $mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
} }
} }
} }
} }
} }
// Delete // Delete
if ($action == 'confirm_deletefile' && $confirm == 'yes') if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,$object); dol_delete_file($file,0,0,0,$object);
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>'; $_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
} }
} }
/* /*
* View * View
*/ */
llxHeader(); llxHeader();
$form = new Form($db); $form = new Form($db);
if ($object->id > 0) if ($object->id > 0)
{ {
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
@ -165,7 +165,7 @@ if ($object->id > 0)
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder".'">'.$langs->trans("BackToList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/comm/propal.php'."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder".'">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
@ -212,14 +212,14 @@ if ($object->id > 0)
// List of document // List of document
$param='&id='.$object->id; $param='&id='.$object->id;
$formfile->list_of_documents($filearray,$object,'propal',$param); $formfile->list_of_documents($filearray,$object,'propal',$param);
} }
else else
{ {
print $langs->trans("UnkownError"); print $langs->trans("UnkownError");
} }
$db->close(); $db->close();
llxFooter(); llxFooter();
?> ?>