2
0
forked from Wavyzz/dolibarr

New: Upload of joined files need create/modify permissions to work

This commit is contained in:
Laurent Destailleur
2009-03-03 00:12:56 +00:00
parent 8476a218e5
commit ba14103659
13 changed files with 121 additions and 111 deletions

View File

@@ -35,6 +35,9 @@ For users:
- New: Add a first version of a module for Paybox. - New: Add a first version of a module for Paybox.
- New: Can add contact to suppliers orders. - New: Can add contact to suppliers orders.
- New: Changements to support the external BitTorrent module. - New: Changements to support the external BitTorrent module.
- New: Can filter on social contribution type in list.
- New: Upload of joined files need create/modify permissions to work.
- Fix: Partial payment on social contributions not shown on main page.
- Fix: Handle correctly the comment in status changing of supplier orders. - Fix: Handle correctly the comment in status changing of supplier orders.
- Fix: Author, title and topic are correctly encoded in PDF. - Fix: Author, title and topic are correctly encoded in PDF.
- Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users. - Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users.

View File

@@ -193,7 +193,7 @@ if ($objectid > 0)
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id,'',0,0,($user->rights->agenda->myactions->create||$user->rights->agenda->actions->create));
// List of document // List of document

View File

@@ -2012,7 +2012,7 @@ else
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET['search_ref'].'">'; print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET['search_ref'].'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="28" name="search_societe" value="'.$_GET['search_societe'].'">'; print '<input class="flat" type="text" size="16" name="search_societe" value="'.$_GET['search_societe'].'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" colspan="1" align="right">'; print '<td class="liste_titre" colspan="1" align="right">';
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">'; print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
@@ -2105,7 +2105,10 @@ else
$userstatic->id=$objp->fk_user_author; $userstatic->id=$objp->fk_user_author;
$userstatic->login=$objp->login; $userstatic->login=$objp->login;
print '<td align="center">'.$userstatic->getLoginUrl(1)."</td>\n"; print '<td align="center">';
if ($userstatic->id) print $userstatic->getLoginUrl(1);
else print '&nbsp;';
print "</td>\n";
print '<td align="right">'.$propalstatic->LibStatut($objp->fk_statut,5)."</td>\n"; print '<td align="right">'.$propalstatic->LibStatut($objp->fk_statut,5)."</td>\n";

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 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 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* *
@@ -156,7 +156,7 @@ if ($propalid > 0)
// 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?propalid='.$propal->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id,'',0,0,$user->rights->propale->creer);
// List of document // List of document

View File

@@ -153,7 +153,7 @@ if ($id > 0 || ! empty($ref))
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$commande->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$commande->id,'',0,0,$user->rights->commande->creer);
// List of document // List of document

View File

@@ -156,7 +156,7 @@ if ($facid > 0)
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$facture->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$facture->id,'',0,0,$user->rights->facture->creer);
// List of document // List of document

View File

@@ -1,6 +1,6 @@
<?php <?php
/* 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-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 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
@@ -152,7 +152,7 @@ if ($contrat->id)
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$contrat->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$contrat->id,'',0,0,$user->rights->contrat->creer);
// List of document // List of document

View File

@@ -154,7 +154,7 @@ if ($object->id)
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id,'',0,0,$user->rights->ficheinter->creer);
// List of document // List of document

View File

@@ -203,7 +203,7 @@ if ($id > 0 || ! empty($ref))
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/commande/document.php?id='.$commande->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/commande/document.php?id='.$commande->id,'',0,0,$user->rights->fournisseur->commande->creer);
// List of document // List of document

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 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 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* *
@@ -166,7 +166,7 @@ if ($facid > 0)
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$facture->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$facture->id,'',0,0,$user->rights->fournisseur->facture->creer);
// List of document // List of document

View File

@@ -51,9 +51,10 @@ class FormFile
* \param titre Titre zone * \param titre Titre zone
* \param addcancel 1=Ajoute un bouton 'Annuler' * \param addcancel 1=Ajoute un bouton 'Annuler'
* \param sectionid If upload must be done inside a particular ECM section * \param sectionid If upload must be done inside a particular ECM section
* \param perm Value of permission ot allow upload
* \return int <0 si ko, >0 si ok * \return int <0 si ko, >0 si ok
*/ */
function form_attach_new_file($url,$titre='',$addcancel=0, $sectionid=0) function form_attach_new_file($url,$titre='',$addcancel=0, $sectionid=0, $perm=1)
{ {
global $conf,$langs; global $conf,$langs;
@@ -80,11 +81,11 @@ class FormFile
print '<input type="hidden" name="max_file_size" value="'.($max*1024).'">'; print '<input type="hidden" name="max_file_size" value="'.($max*1024).'">';
} }
print '<input class="flat" type="file" name="userfile" size="70"'; print '<input class="flat" type="file" name="userfile" size="70"';
print (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled="true"':''); print (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="true"':'');
print '>'; print '>';
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"'; print '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';
print (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled="true"':''); print (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="true"':'');
print '>'; print '>';
if ($addcancel) if ($addcancel)
@@ -94,11 +95,14 @@ class FormFile
} }
if (! empty($conf->global->MAIN_UPLOAD_DOC)) if (! empty($conf->global->MAIN_UPLOAD_DOC))
{
if ($perm)
{ {
print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb");
print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1);
print ')'; print ')';
} }
}
else else
{ {
print ' ('.$langs->trans("UploadDisabled").')'; print ' ('.$langs->trans("UploadDisabled").')';

View File

@@ -1,6 +1,6 @@
<?php <?php
/* 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-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 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
@@ -175,7 +175,7 @@ if ($product->id)
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/product/document.php?id='.$product->id); $formfile->form_attach_new_file(DOL_URL_ROOT.'/product/document.php?id='.$product->id,'',0,0,$user->rights->produit->creer);
// List of document // List of document

View File

@@ -168,7 +168,7 @@ if ($socid > 0)
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/societe/document.php?socid='.$socid); $formfile->form_attach_new_file(DOL_URL_ROOT.'/societe/document.php?socid='.$socid,'',0,0,$user->rights->societe->creer);
// List of document // List of document