Fix: declare $mesg and $mesgs in main.inc.php

Fix: strict mode be back
This commit is contained in:
Regis Houssin 2012-07-23 20:52:55 +02:00
parent 9cf088560f
commit d5ff308992
17 changed files with 139 additions and 217 deletions

View File

@ -40,13 +40,6 @@ $id=GETPOST('id','int');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -120,7 +113,7 @@ 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).
dol_delete_file($file); dol_delete_file($file);
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>'; $_SESSION['dol_message'] = '<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 File

@ -41,13 +41,6 @@ $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$urlfrom=GETPOST('urlfrom'); $urlfrom=GETPOST('urlfrom');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
$object=new Mailing($db); $object=new Mailing($db);
$result=$object->fetch($id); $result=$object->fetch($id);
@ -562,7 +555,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes')
{ {
$object->valid($user); $object->valid($user);
$_SESSION['DolMessage']='<div class="ok">'.$langs->trans("MailingSuccessfullyValidated").'</div>'; $_SESSION['dol_message']='<div class="ok">'.$langs->trans("MailingSuccessfullyValidated").'</div>';
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;

View File

@ -63,6 +63,7 @@ $search_montant_ht=GETPOST('search_montant_ht','alpha');
$sall=GETPOST("sall"); $sall=GETPOST("sall");
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
$mesgs=array();
$year=GETPOST("year"); $year=GETPOST("year");
$month=GETPOST("month"); $month=GETPOST("month");
@ -863,7 +864,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
} }
// Mise a jour d'une ligne dans la propale // Mise a jour d'une ligne dans la propale
else if ($action == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save")) else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('save') == $langs->trans("Save"))
{ {
if (! $object->fetch($_POST["id"]) > 0) if (! $object->fetch($_POST["id"]) > 0)
{ {
@ -1266,7 +1267,7 @@ print $formconfirm;
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='.$sortorder.'">'.$langs->trans("BackToList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">';
@ -1278,7 +1279,7 @@ print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">'; print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
print $langs->trans('RefCustomer').'</td><td align="left">'; print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>'; print '</td>';
if ($action != 'refclient' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&amp;id='.$object->id.'">'.img_edit($langs->trans('Modify')).'</a></td>'; if ($action != 'refclient' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refclient&amp;id='.$object->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="5">'; print '</td><td colspan="5">';
if ($user->rights->propale->creer && $action == 'refclient') if ($user->rights->propale->creer && $action == 'refclient')
@ -1337,10 +1338,10 @@ print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Date'); print $langs->trans('Date');
print '</td>'; print '</td>';
if ($action != 'editdate' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>'; if ($action != 'editdate' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->brouillon && $action == 'editdate') if (! empty($object->brouillon) && $action == 'editdate')
{ {
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1368,10 +1369,10 @@ print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DateEndPropal'); print $langs->trans('DateEndPropal');
print '</td>'; print '</td>';
if ($action != 'editecheance' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editecheance&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>'; if ($action != 'editecheance' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editecheance&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->brouillon && $action == 'editecheance') if (! empty($object->brouillon) && $action == 'editecheance')
{ {
print '<form name="editecheance" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="editecheance" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1382,7 +1383,7 @@ if ($object->brouillon && $action == 'editecheance')
} }
else else
{ {
if ($object->fin_validite) if (! empty($object->fin_validite))
{ {
print dol_print_date($object->fin_validite,'daytext'); print dol_print_date($object->fin_validite,'daytext');
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
@ -1400,7 +1401,7 @@ print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($action != 'editconditions' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'</a></td>'; if ($action != 'editconditions' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editconditions') if ($action == 'editconditions')
@ -1420,7 +1421,7 @@ print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryDate'); print $langs->trans('DeliveryDate');
print '</td>'; print '</td>';
if ($action != 'editdate_livraison' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'</a></td>'; if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editdate_livraison') if ($action == 'editdate_livraison')
@ -1443,9 +1444,9 @@ print '</tr>';
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('AvailabilityPeriod'); print $langs->trans('AvailabilityPeriod');
if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')'; if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')';
print '</td>'; print '</td>';
if ($action != 'editavailability' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'</a></td>'; if ($action != 'editavailability' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editavailability') if ($action == 'editavailability')
@ -1465,7 +1466,7 @@ print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source'); print $langs->trans('Source');
print '</td>'; print '</td>';
if ($action != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'</a></td>'; if ($action != 'editdemandreason' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
//print $object->demand_reason_id; //print $object->demand_reason_id;
@ -1487,7 +1488,7 @@ print '<td width="25%">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'</a></td>'; if ($action != 'editmode' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editmode') if ($action == 'editmode')
@ -1501,7 +1502,7 @@ else
print '</td></tr>'; print '</td></tr>';
// Project // Project
if ($conf->projet->enabled) if (! empty($conf->projet->enabled))
{ {
$langs->load("projects"); $langs->load("projects");
print '<tr><td>'; print '<tr><td>';
@ -1525,7 +1526,7 @@ if ($conf->projet->enabled)
else else
{ {
print '</td></tr></table>'; print '</td></tr></table>';
if (!empty($object->fk_project)) if (! empty($object->fk_project))
{ {
print '<td colspan="3">'; print '<td colspan="3">';
$proj = new Project($db); $proj = new Project($db);
@ -1732,7 +1733,7 @@ if ($action != 'presend')
} }
// Create an order // Create an order
if ($conf->commande->enabled && $object->statut == 2 && $user->societe_id == 0) if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0)
{ {
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
{ {
@ -1763,9 +1764,9 @@ if ($action != 'presend')
} }
// Clone // Clone
if ($object->type == 0 && $user->rights->propale->creer) if ($user->rights->propale->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=propal">'.$langs->trans("ToClone").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object='.$object->element.'">'.$langs->trans("ToClone").'</a>';
} }
// Delete // Delete

View File

@ -2,7 +2,7 @@
/* 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-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,20 +39,14 @@ $confirm = GETPOST('confirm','alpha');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST('ref','alpha'); $ref = GETPOST('ref','alpha');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id) $socid='';
if (! empty($user->societe_id))
{ {
$action=''; $action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'propale', $id, 'propal'); $result = restrictedArea($user, 'propal', $id);
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -77,7 +71,7 @@ if ($object->id > 0)
*/ */
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
@ -131,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$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['dol_message'] = '<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;
} }
@ -149,11 +143,11 @@ $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);
dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal');
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0; $totalsize=0;
@ -161,17 +155,17 @@ if ($object->id > 0)
{ {
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
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/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$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">';
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
print '</td></tr>'; print '</td></tr>';
// Ref client // Ref client
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>'; print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
@ -182,34 +176,34 @@ if ($object->id > 0)
print $object->ref_client; print $object->ref_client;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Customer // Customer
print "<tr><td>".$langs->trans("Company")."</td>"; print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>'; print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg,$mesgs); dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */
if ($action == 'delete') if ($action == 'delete')
{ {
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object); $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
// 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);
@ -219,7 +213,6 @@ else
print $langs->trans("UnkownError"); print $langs->trans("UnkownError");
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 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-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
@ -40,13 +40,6 @@ $confirm = GETPOST('confirm');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST('ref'); $ref = GETPOST('ref');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
{ {
@ -74,7 +67,7 @@ $object = new Commande($db);
*/ */
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
@ -129,7 +122,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); $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). $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['dol_message'] = '<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 File

@ -617,7 +617,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$pa_ht = $_POST['np_buying_price']; $pa_ht = $_POST['np_buying_price'];
else else
$pa_ht = null; $pa_ht = null;
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; if ($tva_npr) $info_bits |= 0x01;
@ -722,7 +722,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s
$pa_ht = $_POST['buying_price']; $pa_ht = $_POST['buying_price'];
else else
$pa_ht = null; $pa_ht = null;
// Check parameters // Check parameters
if (empty($_POST['productid']) && $_POST["type"] < 0) if (empty($_POST['productid']) && $_POST["type"] < 0)
{ {
@ -825,7 +825,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); $mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
$action=''; $action='';
} }
} }
@ -861,7 +861,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer)
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); $mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
$action=''; $action='';
} }
} }
@ -906,7 +906,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
$error++; $error++;
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); $mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
$action=''; $action='';
} }
} }
@ -1017,7 +1017,7 @@ else if ($action == 'remove_file')
/* /*
* Add file in email form * Add file in email form
*/ */
if ($_POST['addfile']) if (GETPOST('addfile'))
{ {
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
@ -1592,7 +1592,6 @@ else
if ($object->id > 0) if ($object->id > 0)
{ {
dol_htmloutput_mesg($mesg,$mesgs); dol_htmloutput_mesg($mesg,$mesgs);
dol_htmloutput_errors('',$errors);
$product_static=new Product($db); $product_static=new Product($db);
@ -1929,10 +1928,10 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source'); print $langs->trans('Source');
print '</td>'; print '</td>';
if ($_GET['action'] != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDemandReason'),1).'</a></td>'; if ($action != 'editdemandreason' && ! empty($object->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDemandReason'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">'; print '</td><td colspan="2">';
if ($_GET['action'] == 'editdemandreason') if ($action == 'editdemandreason')
{ {
$form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1);
} }
@ -1947,7 +1946,7 @@ else
print '</td></tr>'; print '</td></tr>';
// Project // Project
if ($conf->projet->enabled) if (! empty($conf->projet->enabled))
{ {
$langs->load('projects'); $langs->load('projects');
print '<tr><td height="10">'; print '<tr><td height="10">';

View File

@ -43,13 +43,6 @@ $confirm = GETPOST('confirm');
$id = GETPOST('facid','int'); $id = GETPOST('facid','int');
$ref = GETPOST('ref'); $ref = GETPOST('ref');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
{ {
@ -132,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); $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). $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['dol_message'] = '<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 File

@ -41,13 +41,6 @@ $confirm = GETPOST('confirm','alpha');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST('ref','alpha'); $ref = GETPOST('ref','alpha');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -129,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). $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); $ret=dol_delete_file($file,0,0,0,$object);
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>'; $_SESSION['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
} }
@ -175,9 +168,9 @@ if ($object->id)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg,$mesgs); dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -2533,7 +2533,7 @@ abstract class CommonObject
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>'; print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>'; print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>'; print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>'; print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else else
@ -2861,43 +2861,43 @@ abstract class CommonObject
'total_margin' => 0, 'total_margin' => 0,
'total_margin_rate' => '', 'total_margin_rate' => '',
'total_mark_rate' => '' 'total_mark_rate' => ''
); );
foreach($this->lines as $line) { foreach($this->lines as $line) {
if (isset($line->fk_fournprice) && !$force_price) { if (isset($line->fk_fournprice) && !$force_price) {
$product = new ProductFournisseur($this->db); $product = new ProductFournisseur($this->db);
if ( $product->fetch_product_fournisseur_price($line->fk_fournprice)) if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
$line->pa_ht = $product->fourn_unitprice; $line->pa_ht = $product->fourn_unitprice;
if ($conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0) if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
$line->pa_ht += $product->fourn_unitcharges; $line->pa_ht += $product->fourn_unitcharges;
} }
// si prix d'achat non renseign<EFBFBD> et devrait l'<27>tre, alors prix achat = prix vente // si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente
if ((!isset($line->pa_ht) || $line->pa_ht == 0) && ($conf->global->ForceBuyingPriceIfNull == 1)) { if ((!isset($line->pa_ht) || $line->pa_ht == 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) {
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
} }
// calcul des marges // calcul des marges
if(isset($line->fk_remise_except)) { // remise if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale consid<EFBFBD>r<EFBFBD>e comme produit if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
$marginInfos['pa_products'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_products'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
} }
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale consid<EFBFBD>r<EFBFBD>e comme service elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
$marginInfos['pa_services'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_services'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100)); $marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100));
$marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100);
} }
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total
$marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100)); $marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100));
} }
} }
else { else {
$type=$line->product_type?$line->product_type:$line->fk_product_type; $type=$line->product_type?$line->product_type:$line->fk_product_type;
if ($type == 0) { // product if ($type == 0) { // product
$marginInfos['pa_products'] += $line->qty * $line->pa_ht; $marginInfos['pa_products'] += $line->qty * $line->pa_ht;
$marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_total'] += $line->qty * $line->pa_ht; $marginInfos['pa_total'] += $line->qty * $line->pa_ht;
$marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
@ -2910,32 +2910,32 @@ abstract class CommonObject
} }
} }
} }
$marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products']; $marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products'];
if ($marginInfos['pa_products'] > 0) if ($marginInfos['pa_products'] > 0)
$marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5); $marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5);
if ($marginInfos['pv_products'] > 0) if ($marginInfos['pv_products'] > 0)
$marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5); $marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5);
$marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services']; $marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services'];
if ($marginInfos['pa_services'] > 0) if ($marginInfos['pa_services'] > 0)
$marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5); $marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5);
if ($marginInfos['pv_services'] > 0) if ($marginInfos['pv_services'] > 0)
$marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5); $marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5);
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
if ($marginInfos['pa_total'] > 0) if ($marginInfos['pa_total'] > 0)
$marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5); $marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5);
if ($marginInfos['pv_total'] > 0) if ($marginInfos['pv_total'] > 0)
$marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5); $marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5);
return $marginInfos; return $marginInfos;
} }
function displayMarginInfos($force_price=false) { function displayMarginInfos($force_price=false) {
global $langs, $conf; global $langs, $conf;
$marginInfo = $this->getMarginInfos($force_price); $marginInfo = $this->getMarginInfos($force_price);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="30%">'.$langs->trans('Margins').'</td>'; print '<td width="30%">'.$langs->trans('Margins').'</td>';

View File

@ -231,15 +231,7 @@ if ($id > 0 || ! empty($ref))
// Date // Date
print '<tr><td>'.$langs->trans('Date').'</td>'; print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>'; print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource(); print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource().'</td>';
if ($commande->source == 0 && $conf->propal->enabled && $commande->propale_id)
{
// Si source = propal
$propal = new Propal($db);
$propal->fetch($commande->propale_id);
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$propal->id.'">'.$propal->ref.'</a>';
}
print '</td>';
print '</tr>'; print '</tr>';
// Delivery date planned // Delivery date planned
@ -276,7 +268,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($action != 'editconditions' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>'; if ($action != 'editconditions' && ! empty($commande->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">'; print '</td><td colspan="2">';
if ($action == 'editconditions') if ($action == 'editconditions')
@ -294,7 +286,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($actionº != 'editmode' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>'; if ($action != 'editmode' && ! empty($commande->brouillon)) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">'; print '</td><td colspan="2">';
if ($action == 'editmode') if ($action == 'editmode')
@ -394,7 +386,8 @@ if ($id > 0 || ! empty($ref))
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$reste_a_livrer = array(); $toBeShipped=array();
$toBeShippedTotal=0;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
@ -412,25 +405,25 @@ if ($id > 0 || ! empty($ref))
// Product label // Product label
if ($objp->fk_product > 0) if ($objp->fk_product > 0)
{ {
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$commande->fetch_thirdparty(); $commande->fetch_thirdparty();
$prod = new Product($db, $objp->fk_product); $prod = new Product($db, $objp->fk_product);
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$commande->client->default_lang; if (empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label; $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label;
} }
else else
$label = $objp->product_label; $label = $objp->product_label;
print '<td>'; print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
@ -475,17 +468,17 @@ if ($id > 0 || ! empty($ref))
$qtyProdCom=$objp->qty; $qtyProdCom=$objp->qty;
print '<td align="center">'; print '<td align="center">';
// Nb of sending products for this line of order // Nb of sending products for this line of order
$quantite_livree = $commande->expeditions[$objp->rowid]; $qtyAlreadyShipped = (! empty($commande->expeditions[$objp->rowid])?$commande->expeditions[$objp->rowid]:0);
print $quantite_livree; print $qtyAlreadyShipped;
print '</td>'; print '</td>';
// Qty remains to ship // Qty remains to ship
print '<td align="center">'; print '<td align="center">';
if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{ {
$reste_a_livrer[$objp->fk_product] = $objp->qty - $quantite_livree; $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped;
$reste_a_livrer_total += $reste_a_livrer[$objp->fk_product]; $toBeShippedTotal += $toBeShipped[$objp->fk_product];
print $reste_a_livrer[$objp->fk_product]; print $toBeShipped[$objp->fk_product];
} }
else else
{ {
@ -503,7 +496,7 @@ if ($id > 0 || ! empty($ref))
{ {
print '<td align="center">'; print '<td align="center">';
print $product->stock_reel; print $product->stock_reel;
if ($product->stock_reel < $reste_a_livrer[$objp->fk_product]) if ($product->stock_reel < $toBeShipped[$objp->fk_product])
{ {
print ' '.img_warning($langs->trans("StockTooLow")); print ' '.img_warning($langs->trans("StockTooLow"));
} }
@ -580,7 +573,7 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->expedition->creer) if ($user->rights->expedition->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&amp;origin=commande&amp;object_id='.$id.'">'.$langs->trans("NewSending").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&amp;origin=commande&amp;object_id='.$id.'">'.$langs->trans("NewSending").'</a>';
if ($reste_a_livrer_total <= 0) if ($toBeShippedTotal <= 0)
{ {
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
} }
@ -625,7 +618,7 @@ if ($id > 0 || ! empty($ref))
} }
print '<td align="center">'; print '<td align="center">';
print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">'; print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">';
if ($reste_a_livrer_total <= 0) if ($toBeShippedTotal <= 0)
{ {
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
} }

View File

@ -43,13 +43,6 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
@ -128,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). $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['dol_message'] = '<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;
} }
@ -177,9 +170,9 @@ if ($object->id)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg,$mesgs); dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -46,14 +46,6 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$mesg='';
$mesgs=array();
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande_fournisseur', $id,''); $result = restrictedArea($user, 'commande_fournisseur', $id,'');
@ -130,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). $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['dol_message'] = '<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 File

@ -721,6 +721,14 @@ $bc=array(0=>'class="impair"',1=>'class="pair"');
$bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"'); $bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"');
$bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"'); $bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
// Define messages variables
$mesg=''; $mesgs=array();
if (isset($_SESSION['dol_message']))
{
$mesg=$_SESSION['dol_message'];
unset($_SESSION['dol_message']);
}
// Constants used to defined number of lines in textarea // Constants used to defined number of lines in textarea
if (empty($conf->browser->firefox)) if (empty($conf->browser->firefox))
{ {

View File

@ -2082,13 +2082,12 @@ class Product extends CommonObject
function get_arbo_each_prod($multiply=1) function get_arbo_each_prod($multiply=1)
{ {
$this->res = array(); $this->res = array();
if (is_array($this -> sousprods)) if (isset($this->sousprods) && is_array($this->sousprods))
{ {
foreach($this -> sousprods as $nom_pere => $desc_pere) foreach($this->sousprods as $nom_pere => $desc_pere)
{ {
if (is_array($desc_pere)) $this->fetch_prod_arbo($desc_pere,"",$multiply); if (is_array($desc_pere)) $this->fetch_prod_arbo($desc_pere,"",$multiply);
} }
// dol_sort($this->res,);
} }
return $this->res; return $this->res;
} }

View File

@ -39,13 +39,6 @@ $ref = GETPOST('ref','alpha');
$mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0); $mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0);
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
$socid=0; $socid=0;
if ($user->societe_id > 0) $socid=$user->societe_id; if ($user->societe_id > 0) $socid=$user->societe_id;
@ -122,7 +115,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->s
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); $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). $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['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
} }

View File

@ -44,13 +44,6 @@ $ref= GETPOST('ref','alpha');
$withproject=GETPOST('withproject','int'); $withproject=GETPOST('withproject','int');
$project_ref = GETPOST('project_ref','alpha'); $project_ref = GETPOST('project_ref','alpha');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
$socid=0; $socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id; if ($user->societe_id > 0) $socid = $user->societe_id;
@ -119,7 +112,7 @@ if ($action=='delete')
$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).
dol_delete_file($file); dol_delete_file($file);
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>'; $_SESSION['dol_message'] = '<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 File

@ -39,13 +39,6 @@ $confirm=GETPOST('confirm');
$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int')); $id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$mesg='';
if (isset($_SESSION['DolMessage']))
{
$mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']);
}
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -131,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). $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['dol_message'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
} }