From 74cb81b8d3c94cf8c90747cce7d1f81adef8e762 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Nov 2010 16:32:17 +0000 Subject: [PATCH] Work on PHPSane module --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/document.php | 7 +++++++ htdocs/product/fournisseurs.php | 23 ++++++++++++++--------- htdocs/viewimage.php | 9 ++++++++- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 93757a2b060..d82db7d3c8d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -132,7 +132,7 @@ class FormFile * @param genallowed Generation is allowed (1/0 or array of formats) * @param delallowed Remove is allowed (1/0) * @param modelselected Model to preselect by default - * @param allowgenifempty Show warning if no model activated + * @param allowgenifempty Show warning if no model activated * @param forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param iconPDF Show only PDF icon with link (1/0) * @param maxfilenamelength Max length for filename shown diff --git a/htdocs/document.php b/htdocs/document.php index 5e7f52f8d5d..c3ddbd982f0 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -397,6 +397,13 @@ if ($modulepart) $original_file=$conf->adherent->dir_output.'/'.$original_file; } + // Wrapping for PHPSane + else if ($modulepart == 'phpsane_user_temp') + { + $accessallowed=1; + $original_file=$conf->phpsane->dir_temp.'/'.$user->id.'/'.$original_file; + } + // Generic wrapping else { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 54fda38de0c..c07d3462603 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -37,11 +37,11 @@ $langs->load("suppliers"); $langs->load("bills"); // If socid provided by ajax company selector -if (! empty($_REQUEST['id_fourn_id'])) +if (! empty($_REQUEST['search_fourn_id'])) { - $_GET['id_fourn'] = $_GET['id_fourn_id']; - $_POST['id_fourn'] = $_POST['id_fourn_id']; - $_REQUEST['id_fourn'] = $_REQUEST['id_fourn_id']; + $_GET['id_fourn'] = $_GET['search_fourn_id']; + $_POST['id_fourn'] = $_POST['search_fourn_id']; + $_REQUEST['id_fourn'] = $_REQUEST['search_fourn_id']; } // Security check @@ -89,19 +89,24 @@ if ($_GET["action"] == 'remove_pf') if ($_POST["action"] == 'updateprice' && $_POST["cancel"] <> $langs->trans("Cancel")) { + $id_fourn=GETPOST("id_fourn"); + if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn"); + $ref_fourn=GETPOST("ref_fourn"); + if (empty($ref_fourn)) $id_fourn=GETPOST("search_ref_fourn"); + $product = new ProductFournisseur($db); - $result=$product->fetch($_REQUEST["id"]); + $result=$product->fetch(GETPOST("id")); if ($result > 0) { $db->begin(); $error=0; - if (! $_POST["ref_fourn"]) + if (! $ref_fourn) { $error++; $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")).'
'; } - if ($_POST["id_fourn"] <= 0) + if ($id_fourn <= 0) { //print "eee".$_POST["id_fourn"]; $error++; @@ -110,7 +115,7 @@ if ($_POST["action"] == 'updateprice' && $_POST["cancel"] <> $langs->trans("Canc if (! $error) { - $ret=$product->add_fournisseur($user, $_POST["id_fourn"], $_POST["ref_fourn"]); + $ret=$product->add_fournisseur($user, $id_fourn, $ref_fourn); if ($ret == -3) { $error++; @@ -134,7 +139,7 @@ if ($_POST["action"] == 'updateprice' && $_POST["cancel"] <> $langs->trans("Canc if ($_POST["price"] >= 0) { $supplier=new Fournisseur($db); - $result=$supplier->fetch($_POST["id_fourn"]); + $result=$supplier->fetch($id_fourn); $ret=$product->update_buyprice($_POST["qty"], $_POST["price"], $user, $_POST["price_base_type"], $supplier); if ($ret < 0) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 1da7b5f0638..976a72ac46f 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -270,7 +270,14 @@ if ($modulepart) $original_file=$conf->mailing->dir_temp.'/'.$original_file; } - // GENERIC Wrapping + // Wrapping pour les icones de background des mailings + elseif ($modulepart == 'phpsane_user_temp') + { + $accessallowed=1; + $original_file=$conf->phpsane->dir_temp.'/'.$user->id.'/'.$original_file; + } + + // GENERIC Wrapping // If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser // If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser