forked from Wavyzz/dolibarr
Fix: try to use another method for messages
This commit is contained in:
@@ -113,7 +113,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$langs->load("other");
|
||||
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
dol_delete_file($file);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
@@ -28,21 +28,22 @@
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php');
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
|
||||
}
|
||||
|
||||
$langs->load("propal");
|
||||
if ($conf->projet->enabled) $langs->load("projects");
|
||||
if (! empty($conf->projet->enabled))
|
||||
$langs->load("projects");
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("orders");
|
||||
$langs->load("deliveries");
|
||||
|
||||
$action=GETPOST('action');
|
||||
$mesg=GETPOST('mesg');
|
||||
$action=GETPOST('action','alpha');
|
||||
$origin=GETPOST('origin','alpha');
|
||||
$originid=GETPOST('originid','int');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
@@ -67,8 +68,6 @@ print_fiche_titre($langs->trans("NewProp"));
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
// Add new proposal
|
||||
if ($action == 'create')
|
||||
{
|
||||
@@ -117,16 +116,19 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
if (isset($_GET["origin"]) && $_GET["origin"] != 'project' && isset($_GET["originid"]))
|
||||
if ($origin != 'project' && $originid)
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$_GET["origin"].'">';
|
||||
print '<input type="hidden" name="originid" value="'.$_GET["originid"].'">';
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||
print '<input type="hidden" name="originid" value="'.$originid.'">';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" value="'.$numpr.'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">'.$numpr.'</td>';
|
||||
print '<input type="hidden" name="ref" value="'.$numpr.'">';
|
||||
print '</tr>';
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td colspan="2">';
|
||||
@@ -141,7 +143,7 @@ if ($action == 'create')
|
||||
|
||||
// Contacts
|
||||
print "<tr><td>".$langs->trans("DefaultContact")."</td><td colspan=\"2\">\n";
|
||||
$form->select_contacts($soc->id,$setcontact,'contactidp',1);
|
||||
$form->select_contacts($soc->id,'','contactidp',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
@@ -175,12 +177,12 @@ if ($action == 'create')
|
||||
|
||||
// What trigger creation
|
||||
print '<tr><td>'.$langs->trans('Source').'</td><td>';
|
||||
$form->select_demand_reason($object->demand_reason,'demand_reason_id',"SRC_PROP",1);
|
||||
$form->select_demand_reason('','demand_reason_id',"SRC_PROP",1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Delivery delay
|
||||
print '<tr><td>'.$langs->trans('AvailabilityPeriod').'</td><td colspan="2">';
|
||||
$form->select_availability($object->availability,'availability_id','',1);
|
||||
$form->select_availability('','availability_id','',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Delivery date (or manufacturing)
|
||||
@@ -213,7 +215,7 @@ if ($action == 'create')
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$projectid = 0;
|
||||
if (isset($_GET["origin"]) && $_GET["origin"] == 'project') $projectid = ($_GET["originid"]?$_GET["originid"]:0);
|
||||
if ($origin == 'project') $projectid = ($originid?$originid:0);
|
||||
|
||||
print '<tr>';
|
||||
print '<td valign="top">'.$langs->trans("Project").'</td><td colspan="2">';
|
||||
@@ -228,7 +230,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
@@ -341,6 +343,9 @@ if ($action == 'create')
|
||||
print "</form>";
|
||||
}
|
||||
|
||||
$db->close();
|
||||
dol_htmloutput_events($mesgs,$errors,$warnings);
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@@ -555,7 +555,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes')
|
||||
{
|
||||
$object->valid($user);
|
||||
|
||||
$_SESSION['dol_message']='<div class="ok">'.$langs->trans("MailingSuccessfullyValidated").'</div>';
|
||||
$_SESSION['dol_events']['mesgs']='<div class="ok">'.$langs->trans("MailingSuccessfullyValidated").'</div>';
|
||||
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
|
||||
@@ -276,14 +276,14 @@ else if ($action == 'add' && $user->rights->propale->creer)
|
||||
$object->socid=$socid;
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$date_delivery=dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
||||
$datep=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$date_delivery=dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
|
||||
if (empty($datep))
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create&mesg='.urlencode($mesg));
|
||||
$errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date"));
|
||||
$_SESSION['dol_events']['errors']=$errors;
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create');
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -292,57 +292,57 @@ else if ($action == 'add' && $user->rights->propale->creer)
|
||||
$db->begin();
|
||||
|
||||
// Si on a selectionne une propal a copier, on realise la copie
|
||||
if($_POST['createmode']=='copy' && $_POST['copie_propal'])
|
||||
if(GETPOST('createmode')=='copy' && GETPOST('copie_propal'))
|
||||
{
|
||||
if ($object->fetch($_POST['copie_propal']) > 0)
|
||||
if ($object->fetch(GETPOST('copie_propal')) > 0)
|
||||
{
|
||||
$object->ref = $_POST['ref'];
|
||||
$object->ref = GETPOST('ref');
|
||||
$object->datep = $datep;
|
||||
$object->date_livraison = $date_delivery;
|
||||
$object->availability_id = $_POST['availability_id'];
|
||||
$object->demand_reason_id = $_POST['demand_reason_id'];
|
||||
$object->fk_delivery_address = $_POST['fk_address'];
|
||||
$object->duree_validite = $_POST['duree_validite'];
|
||||
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->contactid = $_POST['contactidp'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->duree_validite = GETPOST('duree_validite');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->remise_percent = GETPOST('remise_percent');
|
||||
$object->remise_absolue = GETPOST('remise_absolue');
|
||||
$object->socid = GETPOST('socid');
|
||||
$object->contactid = GETPOST('contactidp');
|
||||
$object->fk_project = GETPOST('projectid');
|
||||
$object->modelpdf = GETPOST('model');
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = $_POST['note'];
|
||||
$object->note = GETPOST('note');
|
||||
$object->statut = 0;
|
||||
|
||||
$id = $object->create_from($user);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToCopyProposal",$_POST['copie_propal']).'</div>';
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')).'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->ref = $_POST['ref'];
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref = GETPOST('ref');
|
||||
$object->ref_client = GETPOST('ref_client');
|
||||
$object->datep = $datep;
|
||||
$object->date_livraison = $date_delivery;
|
||||
$object->availability_id = $_POST['availability_id'];
|
||||
$object->demand_reason_id = $_POST['demand_reason_id'];
|
||||
$object->fk_delivery_address = $_POST['fk_address'];
|
||||
$object->duree_validite = $_POST['duree_validite'];
|
||||
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->duree_validite = GETPOST('duree_validite');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
|
||||
$object->contactid = $_POST['contactidp'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->contactid = GETPOST('contactidp');
|
||||
$object->fk_project = GETPOST('projectid');
|
||||
$object->modelpdf = GETPOST('model');
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = $_POST['note'];
|
||||
$object->note = GETPOST('note');
|
||||
|
||||
$object->origin = $_POST['origin'];
|
||||
$object->origin_id = $_POST['originid'];
|
||||
$object->origin = GETPOST('origin');
|
||||
$object->origin_id = GETPOST('originid');
|
||||
|
||||
for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++)
|
||||
{
|
||||
@@ -363,9 +363,9 @@ else if ($action == 'add' && $user->rights->propale->creer)
|
||||
$error=0;
|
||||
|
||||
// Insertion contact par defaut si defini
|
||||
if ($_POST["contactidp"])
|
||||
if (GETPOST('contactidp'))
|
||||
{
|
||||
$result=$object->add_contact($_POST["contactidp"],'CUSTOMER','external');
|
||||
$result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external');
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$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).
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$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);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -1437,14 +1437,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesg='<div class="error">'.$mailfile->error.'</div>';
|
||||
$mesgs[]='<div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
|
||||
$mesgs[]=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
|
||||
|
||||
$error=0;
|
||||
|
||||
@@ -1471,7 +1471,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
{
|
||||
// Redirect here
|
||||
// This avoid sending mail twice if going out and then back to page
|
||||
$_SESSION['dol_message'] = $mesg;
|
||||
$_SESSION['dol_events']['mesgs'] = $mesgs;
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$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);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -3448,6 +3448,43 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print formated messages to output (Used to show messages on html output).
|
||||
*
|
||||
* @param array $mesgs Messages array
|
||||
* @param array $errors Errors array
|
||||
* @param array $warnings Warnings array
|
||||
* @return void
|
||||
*
|
||||
* @see dol_htmloutput_mesg
|
||||
*/
|
||||
function dol_htmloutput_events($mesgs=array(),$errors=array(),$warnings=array())
|
||||
{
|
||||
if (isset($_SESSION['dol_events']))
|
||||
{
|
||||
if (is_array($mesgs) && isset($_SESSION['dol_events']['mesgs'])) {
|
||||
$mesgs = array_merge($mesgs, $_SESSION['dol_events']['mesgs']);
|
||||
}
|
||||
if (is_array($errors) && isset($_SESSION['dol_events']['errors'])) {
|
||||
$errors = array_merge($errors, $_SESSION['dol_events']['errors']);
|
||||
}
|
||||
if (is_array($warnings) && isset($_SESSION['dol_events']['warnings'])) {
|
||||
$warnings = array_merge($warnings, $_SESSION['dol_events']['warnings']);
|
||||
}
|
||||
|
||||
unset($_SESSION['dol_events']);
|
||||
}
|
||||
|
||||
if (is_array($mesgs) && ! empty($mesgs)) {
|
||||
dol_htmloutput_mesg('',$mesgs);
|
||||
}
|
||||
if (is_array($errors) && ! empty($errors)) {
|
||||
dol_htmloutput_mesg('',$errors, 'error');
|
||||
}
|
||||
if (is_array($warnings) && ! empty($warnings)) {
|
||||
dol_htmloutput_mesg('',$warnings, 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formated messages to output (Used to show messages on html output).
|
||||
@@ -3469,18 +3506,6 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
|
||||
$out='';
|
||||
$divstart=$divend='';
|
||||
|
||||
// Use session mesg
|
||||
if (isset($_SESSION['mesg']))
|
||||
{
|
||||
$mesgstring=$_SESSION['mesg'];
|
||||
unset($_SESSION['mesg']);
|
||||
}
|
||||
if (isset($_SESSION['mesgarray']))
|
||||
{
|
||||
$mesgarray=$_SESSION['mesgarray'];
|
||||
unset($_SESSION['mesgarray']);
|
||||
}
|
||||
|
||||
// If inline message with no format, we add it.
|
||||
if ((empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && ! preg_match('/<div class=".*">/i',$out))
|
||||
{
|
||||
|
||||
@@ -437,7 +437,7 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$_SESSION['mesg']=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
||||
$_SESSION['dol_events']['mesgs']=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
|
||||
$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);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
|
||||
$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);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -723,10 +723,22 @@ $bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
|
||||
|
||||
// Define messages variables
|
||||
$mesg=''; $mesgs=array(); $warning=''; $warnings=array(); $error=0; $errors=array();
|
||||
if (isset($_SESSION['dol_message']))
|
||||
|
||||
// TODO For backward compatibility, see dol_htmloutput_events() in functions.lib.php
|
||||
if (isset($_SESSION['dol_events']))
|
||||
{
|
||||
$mesgs[]=$_SESSION['dol_message'];
|
||||
unset($_SESSION['dol_message']);
|
||||
if (is_array($mesgs) && isset($_SESSION['dol_events']['mesgs'])) {
|
||||
$mesgs = array_merge($mesgs, $_SESSION['dol_events']['mesgs']);
|
||||
}
|
||||
if (is_array($errors) && isset($_SESSION['dol_events']['errors'])) {
|
||||
$errors = array_merge($errors, $_SESSION['dol_events']['errors']);
|
||||
$mesgs = array_merge($mesgs, $_SESSION['dol_events']['errors']); // For backward compatibility
|
||||
}
|
||||
if (is_array($warnings) && isset($_SESSION['dol_events']['warnings'])) {
|
||||
$warnings = array_merge($warnings, $_SESSION['dol_events']['warnings']);
|
||||
}
|
||||
|
||||
unset($_SESSION['dol_events']);
|
||||
}
|
||||
|
||||
// Constants used to defined number of lines in textarea
|
||||
|
||||
@@ -115,7 +115,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->s
|
||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$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);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ if ($action=='delete')
|
||||
$langs->load("other");
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
dol_delete_file($file);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$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);
|
||||
$_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['dol_events']['mesgs'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user