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

This commit is contained in:
Laurent Destailleur 2012-07-31 00:07:19 +02:00
commit 2f19fd9612
7 changed files with 75 additions and 81 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com> * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net> * Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -54,7 +54,7 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$upload_dir = dirname(str_replace("../","/", $conf->ecm->dir_output.'/'.$file)); $upload_dir = dirname(str_replace("../","/", $conf->ecm->dir_output.'/'.$file));
$ecmdir = new EcmDirectory($db); $ecmdir = new EcmDirectory($db);
@ -121,7 +121,7 @@ if (! isset($mode) || $mode != 'noajax')
// Ajout directives pour resoudre bug IE // Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate'); header('Cache-Control: Public, must-revalidate');
header('Pragma: public'); header('Pragma: public');
top_httphead(); top_httphead();
} }
@ -137,7 +137,7 @@ if (! dol_is_dir($upload_dir))
} }
print '<!-- TYPE='.$type.' -->'."\n"; print '<!-- TYPE='.$type.' -->'."\n";
print '<!-- Page called with mode='.$mode.' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n"; print '<!-- Page called with mode='.(isset($mode)?$mode:'').' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
$param=''; $param='';
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); $param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
@ -252,7 +252,7 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
if ($section) if ($section)
{ {
$param.=($param?'?':'').(preg_replace('/^&/','',$param)); $param.=($param?'?':'').(preg_replace('/^&/','',$param));
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php');
$useglobalvars=1; $useglobalvars=1;
$form = new Form($db); $form = new Form($db);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 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
@ -23,8 +23,8 @@
* \brief Module to generate box of last products/services * \brief Module to generate box of last products/services
*/ */
include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
include_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
/** /**
@ -105,7 +105,8 @@ class box_produits extends ModeleBoxes
if ($resultd) if ($resultd)
{ {
$objtp = $db->fetch_object($resultd); $objtp = $db->fetch_object($resultd);
if ($objtp->label != '') $objp->label = $objtp->label; if (isset($objtp->label) && $objtp->label != '')
$objp->label = $objtp->label;
} }
} }

View File

@ -581,7 +581,8 @@ class FormFile
&& ! preg_match('/\.meta$/i',$file['name'])) && ! preg_match('/\.meta$/i',$file['name']))
{ {
// Define relative path used to store the file // Define relative path used to store the file
if (! $relativepath) $relativepath=dol_sanitizeFileName($object->ref).'/'; if (empty($relativepath))
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
@ -725,14 +726,14 @@ class FormFile
$id=0; $ref=''; $label=''; $id=0; $ref=''; $label='';
// To show ref or specific information according to view to show (defined by $module) // To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; } if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; } if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; } if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; } if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; } if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; } if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; } if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; } if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if (! $id && ! $ref) continue; if (! $id && ! $ref) continue;

View File

@ -287,7 +287,7 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
if ($mode == 1) if ($mode == 1)
{ {
$tmp=explode('/',$mime); $tmp=explode('/',$mime);
return $tmp[1]; return (! empty($tmp[1])?$tmp[1]:$tmp[0]);
} }
if ($mode == 2) if ($mode == 2)
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2008-2012 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
@ -529,7 +529,7 @@ class EcmDirectory // extends CommonObject
{ {
global $conf; global $conf;
if (empty($force) && $this->full_arbo_loaded) if (empty($force) && ! empty($this->full_arbo_loaded))
{ {
return $this->cats; return $this->cats;
} }
@ -561,7 +561,7 @@ class EcmDirectory // extends CommonObject
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$this->cats[$obj->rowid]['id'] = $obj->rowid; $this->cats[$obj->rowid]['id'] = $obj->rowid;
$this->cats[$obj->rowid]['id_mere'] = $this->motherof[$obj->rowid]; $this->cats[$obj->rowid]['id_mere'] = (isset($this->motherof[$obj->rowid])?$this->motherof[$obj->rowid]:'');
$this->cats[$obj->rowid]['label'] = $obj->label; $this->cats[$obj->rowid]['label'] = $obj->label;
$this->cats[$obj->rowid]['description'] = $obj->description; $this->cats[$obj->rowid]['description'] = $obj->description;
$this->cats[$obj->rowid]['cachenbofdoc'] = $obj->cachenbofdoc; $this->cats[$obj->rowid]['cachenbofdoc'] = $obj->cachenbofdoc;
@ -617,7 +617,7 @@ class EcmDirectory // extends CommonObject
function build_path_from_id_categ($id_categ,$protection=0) function build_path_from_id_categ($id_categ,$protection=0)
{ {
// Define fullpath // Define fullpath
if (isset($this->cats[$id_categ]['id_mere'])) if (! empty($this->cats[$id_categ]['id_mere']))
{ {
$this->cats[$id_categ]['fullpath'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fullpath']; $this->cats[$id_categ]['fullpath'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];
$this->cats[$id_categ]['fullpath'].='_'.$id_categ; $this->cats[$id_categ]['fullpath'].='_'.$id_categ;
@ -638,7 +638,7 @@ class EcmDirectory // extends CommonObject
// Traite ces enfants // Traite ces enfants
$protection++; $protection++;
if ($protection > 20) return; // On ne traite pas plus de 20 niveaux if ($protection > 20) return; // On ne traite pas plus de 20 niveaux
if (is_array($this->cats[$id_categ]['id_children'])) if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children']))
{ {
foreach($this->cats[$id_categ]['id_children'] as $key => $val) foreach($this->cats[$id_categ]['id_children'] as $key => $val)
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2008-2012 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
@ -39,10 +39,12 @@ $langs->load("bills");
$langs->load("contracts"); $langs->load("contracts");
$langs->load("categories"); $langs->load("categories");
if (!$user->rights->ecm->setup) accessforbidden(); if (! $user->rights->ecm->setup) accessforbidden();
// Get parameters // Get parameters
$socid = GETPOST("socid","int"); $socid = GETPOST('socid','int');
$action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -51,9 +53,9 @@ if ($user->societe_id > 0)
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$section=$_GET["section"]; $section=$urlsection=GETPOST('section');
if (! $section) $section='misc'; if (empty($urlsection)) $urlsection='misc';
$upload_dir = $conf->ecm->dir_output.'/'.$section; $upload_dir = $conf->ecm->dir_output.'/'.$urlsection;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -66,9 +68,9 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="label"; if (! $sortfield) $sortfield="label";
$ecmdir = new EcmDirectory($db); $ecmdir = new EcmDirectory($db);
if (! empty($_GET["section"])) if (! empty($section))
{ {
$result=$ecmdir->fetch($_GET["section"]); $result=$ecmdir->fetch($section);
if (! $result > 0) if (! $result > 0)
{ {
dol_print_error($db,$ecmdir->error); dol_print_error($db,$ecmdir->error);
@ -77,14 +79,12 @@ if (! empty($_GET["section"]))
} }
/******************************************************************* /*
* ACTIONS * Actions
* */
* Put here all code to do according to value of "action" parameter
********************************************************************/
// Action ajout d'un produit ou service // Action ajout d'un produit ou service
if ($_POST["action"] == 'add' && $user->rights->ecm->setup) if ($action == 'add' && $user->rights->ecm->setup)
{ {
if (! empty($_POST["cancel"])) if (! empty($_POST["cancel"]))
{ {
@ -100,8 +100,8 @@ if ($_POST["action"] == 'add' && $user->rights->ecm->setup)
if (! $ecmdir->label) if (! $ecmdir->label)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
$_GET["action"] = "create"; $action = 'create';
$ok=false; $ok=false;
} }
@ -117,34 +117,32 @@ if ($_POST["action"] == 'add' && $user->rights->ecm->setup)
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans($ecmdir->error).'</div>'; setEventMessage($langs->trans($ecmdir->error), 'errors');
$_GET["action"] = "create"; $action = 'create';
} }
} }
} }
// Suppression fichier // Suppression fichier
if ($_POST['action'] == 'confirm_deletesection' && $_POST['confirm'] == 'yes') if ($action == 'confirm_deletesection' && $confirm == 'yes')
{ {
$result=$ecmdir->delete($user); $result=$ecmdir->delete($user);
$mesg = '<div class="ok">'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'</div>'; setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));
} }
/******************************************************************* /*
* PAGE * View
* */
* Put here all code to do according to value of "action" parameter
********************************************************************/
llxHeader(); llxHeader();
$form=new Form($db); $form=new Form($db);
$formecm=new FormEcm($db); $formecm=new FormEcm($db);
if ($_GET["action"] == 'create') if ($action == 'create')
{ {
//*********************** //***********************
// Create // Create
@ -155,7 +153,6 @@ if ($_GET["action"] == 'create')
$title=$langs->trans("ECMNewSection"); $title=$langs->trans("ECMNewSection");
print_fiche_titre($title); print_fiche_titre($title);
if ($mesg) { print $mesg."<br>"; }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -186,7 +183,7 @@ if ($_GET["action"] == 'create')
} }
if (! $_GET["action"] || $_GET["action"] == 'delete_section') if (empty($action) || $action == 'delete_section')
{ {
//*********************** //***********************
// List // List
@ -204,15 +201,12 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
*/ */
// Confirmation de la suppression d'une ligne categorie // Confirmation de la suppression d'une ligne categorie
if ($_GET['action'] == 'delete_section') if ($action == 'delete_section')
{ {
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_GET["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection');
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
if ($mesg) { print $mesg."<br>"; }
// Construit fiche rubrique // Construit fiche rubrique
@ -231,7 +225,6 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
// End of page // End of page
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -34,6 +34,9 @@ $langs->load("ecm");
$langs->load("companies"); $langs->load("companies");
$langs->load("other"); $langs->load("other");
$action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha');
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -101,12 +104,12 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
// Echec transfert (fichier depassant la limite ?) // Echec transfert (fichier depassant la limite ?)
$langs->load("errors"); $langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'</div>'; setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors');
} }
} }
// Remove file // Remove file
if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes') if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
$langs->load("other"); $langs->load("other");
$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).
@ -118,7 +121,7 @@ if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes')
} }
// Remove dir // Remove dir
if (GETPOST('action') == 'confirm_deletedir' && GETPOST('confirm') == 'yes') if ($action == 'confirm_deletedir' && $confirm == 'yes')
{ {
// Fetch was already done // Fetch was already done
$result=$ecmdir->delete($user); $result=$ecmdir->delete($user);
@ -129,12 +132,12 @@ if (GETPOST('action') == 'confirm_deletedir' && GETPOST('confirm') == 'yes')
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans($ecmdir->error,$ecmdir->label).'</div>'; setEventMessage($langs->trans($ecmdir->error,$ecmdir->label), 'errors');
} }
} }
// Update description // Update description
if (GETPOST('action') == 'update' && ! GETPOST('cancel')) if ($action == 'update' && ! GETPOST('cancel'))
{ {
$error=0; $error=0;
@ -151,8 +154,7 @@ if (GETPOST('action') == 'update' && ! GETPOST('cancel'))
if ($result > 0) if ($result > 0)
{ {
// Try to rename file if changed // Try to rename file if changed
if ($oldlabel != $ecmdir->label if ($oldlabel != $ecmdir->label && file_exists($olddir))
&& file_exists($olddir))
{ {
$newdir=$ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory $newdir=$ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory
$newdir=$conf->ecm->dir_output.'/'.$newdir; $newdir=$conf->ecm->dir_output.'/'.$newdir;
@ -161,7 +163,7 @@ if (GETPOST('action') == 'update' && ! GETPOST('cancel'))
if (! $result) if (! $result)
{ {
$langs->load('errors'); $langs->load('errors');
$mesg='<div class="error">'.$langs->trans('ErrorFailToRenameDir',$olddir,$newdir).'</div>'; setEventMessage($langs->trans('ErrorFailToRenameDir',$olddir,$newdir), 'errors');
$error++; $error++;
} }
} }
@ -181,7 +183,7 @@ if (GETPOST('action') == 'update' && ! GETPOST('cancel'))
else else
{ {
$db->rollback(); $db->rollback();
$mesg='<div class="error">'.$ecmdir->error.'</div>'; setEventMessage($ecmdir->error, 'errors');
} }
} }
@ -210,7 +212,7 @@ foreach($filearray as $key => $file)
$head = ecm_prepare_head($ecmdir); $head = ecm_prepare_head($ecmdir);
dol_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), '', 'dir'); dol_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), '', 'dir');
if ($_GET["action"] == 'edit') if ($action == 'edit')
{ {
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -228,7 +230,7 @@ $i=0;
while ($tmpecmdir && $result > 0) while ($tmpecmdir && $result > 0)
{ {
$tmpecmdir->ref=$tmpecmdir->label; $tmpecmdir->ref=$tmpecmdir->label;
if ($i == 0 && $_GET["action"] == 'edit') if ($i == 0 && $action == 'edit')
{ {
$s='<input type="text" name="label" size="40" maxlength="32" value="'.$tmpecmdir->label.'">'; $s='<input type="text" name="label" size="40" maxlength="32" value="'.$tmpecmdir->label.'">';
} }
@ -249,7 +251,7 @@ print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$l
print $s; print $s;
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
if ($_GET["action"] == 'edit') if ($action == 'edit')
{ {
print '<textarea class="flat" name="description" cols="80">'; print '<textarea class="flat" name="description" cols="80">';
print $ecmdir->description; print $ecmdir->description;
@ -274,7 +276,7 @@ print '</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
print dol_print_size($totalsize); print dol_print_size($totalsize);
print '</td></tr>'; print '</td></tr>';
if ($_GET["action"] == 'edit') if ($action == 'edit')
{ {
print '<tr><td colspan="2" align="center">'; print '<tr><td colspan="2" align="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
@ -283,7 +285,7 @@ if ($_GET["action"] == 'edit')
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
if ($_GET["action"] == 'edit') if ($action == 'edit')
{ {
print '</form>'; print '</form>';
} }
@ -292,7 +294,7 @@ print '</div>';
// Actions buttons // Actions buttons
if ($_GET["action"] != 'edit' && $_GET['action'] != 'delete') if ($action != 'edit' && $action != 'delete')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
@ -328,18 +330,15 @@ if ($_GET["action"] != 'edit' && $_GET['action'] != 'delete')
print '</div>'; print '</div>';
} }
if ($mesg) { print '<br>'.$mesg.'<br>'; }
// Confirm remove file // Confirm remove file
if ($_GET['action'] == 'delete') if ($action == 'delete')
{ {
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&amp;urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&amp;urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Confirm remove file // Confirm remove file
if ($_GET['action'] == 'delete_dir') if ($action == 'delete_dir')
{ {
$relativepathwithoutslash=preg_replace('/[\/]$/','',$relativepath); $relativepathwithoutslash=preg_replace('/[\/]$/','',$relativepath);
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$relativepathwithoutslash), 'confirm_deletedir', '', 1, 1); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$relativepathwithoutslash), 'confirm_deletedir', '', 1, 1);