diff --git a/ChangeLog b/ChangeLog index 5ace931caca..87a3e5e8172 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,9 @@ For users: - New: Add a first version of a module for Paybox. - New: Can add contact to suppliers orders. - 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: Author, title and topic are correctly encoded in PDF. - Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users. diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 4a02df48032..e6e3de8e4e6 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + /** \file htdocs/comm/action/document.php \ingroup agenda @@ -43,10 +43,10 @@ if (isset($_GET["error"])) $error=$_GET["error"]; $objectid = isset($_GET["id"])?$_GET["id"]:''; // Security check -if ($user->societe_id > 0) +if ($user->societe_id > 0) { unset($_GET["action"]); - $action=''; + $action=''; $socid = $user->societe_id; } @@ -118,7 +118,7 @@ if ($objectid > 0) $company=new Societe($db); $company->fetch($act->societe->id); $act->societe=$company; - + $author=new User($db); $author->id=$act->author->id; $author->fetch(); @@ -127,37 +127,37 @@ if ($objectid > 0) $contact=new Contact($db); $contact->fetch($act->contact->id); $act->contact=$contact; - + $h=0; - + $head[$h][0] = DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objectid; $head[$h][1] = $langs->trans("CardAction"); $hselected=$h; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$objectid; $head[$h][1] = $langs->trans('Documents'); $hselected=$h; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/comm/action/info.php?id='.$objectid; $head[$h][1] = $langs->trans('Info'); $h++; - + dol_fiche_head($head, $hselected, $langs->trans("Action")); - + // Affichage fiche action en mode visu print ''; - + // Type print ''; - + // Libelle print ''; - + // Societe - contact print ''; print ''; @@ -170,9 +170,9 @@ if ($objectid > 0) { print $langs->trans("None"); } - + print ''; - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); $totalsize=0; @@ -180,22 +180,22 @@ if ($objectid > 0) { $totalsize+=$file['size']; } - - + + print ''; print ''; print '
'.$langs->trans("Ref").''.$act->id.'
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Title").''.$act->label.'
'.$langs->trans("Company").''.$act->societe->getNomUrl(1).''.$langs->trans("Contact").'
'.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - + print ''; - + if ($mesg) { print $mesg."
"; } - - + + // Affiche formulaire upload $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 $param='&id='.$act->id; $formfile->list_of_documents($filearray,$act,'actions',$param); @@ -203,7 +203,7 @@ if ($objectid > 0) else { dol_print_error($db); - } + } } else { diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index cb2ddc10801..a212e133799 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1984,7 +1984,7 @@ else { $propalstatic=new Propal($db); $userstatic=new User($db); - + $num = $db->num_rows($result); $param='&socid='.$socid.'&viewstatut='.$viewstatut; @@ -2012,7 +2012,7 @@ else print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print $langs->trans('Month').': '; @@ -2105,12 +2105,15 @@ else $userstatic->id=$objp->fk_user_author; $userstatic->login=$objp->login; - print ''.$userstatic->getLoginUrl(1)."\n"; - + print ''; + if ($userstatic->id) print $userstatic->getLoginUrl(1); + else print ' '; + print "\n"; + print ''.$propalstatic->LibStatut($objp->fk_statut,5)."\n"; - + print ' '; - + print "\n"; $total = $total + $objp->total_ht; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 4a12df9f6cc..11713ce106a 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005 Regis Houssin * @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/** \file htdocs/comm/propal/document.php \ingroup propale \brief Page de gestion des documents attachées à une proposition commerciale @@ -40,10 +40,10 @@ $action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action' $propalid = isset($_GET["propalid"])?$_GET["propalid"]:''; // Security check -if ($user->societe_id) +if ($user->societe_id) { unset($_GET["action"]); - $action=''; + $action=''; $socid = $user->societe_id; } $result = restrictedArea($user, 'propale', $propalid, 'propal'); @@ -64,7 +64,7 @@ $pagenext = $page + 1; /* * Actions */ - + // Envoi fichier if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { @@ -74,7 +74,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { $upload_dir = $conf->propal->dir_output . "/" . sanitizeFileName($propal->ref); if (! is_dir($upload_dir)) create_exdir($upload_dir); - + if (is_dir($upload_dir)) { if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0) > 0) @@ -111,7 +111,7 @@ if ($action=='delete') /* * Affichage */ - + llxHeader(); if ($propalid > 0) @@ -127,7 +127,7 @@ if ($propalid > 0) $head = propal_prepare_head($propal); dol_fiche_head($head, 'document', $langs->trans('Proposal')); - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); $totalsize=0; @@ -135,7 +135,7 @@ if ($propalid > 0) { $totalsize+=$file['size']; } - + print ''; @@ -156,7 +156,7 @@ if ($propalid > 0) // Affiche formulaire upload $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 diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 22817576444..01d2e742a98 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -65,7 +65,7 @@ $pagenext = $page + 1; $id = $_GET['id']; $ref= $_GET['ref']; $commande = new Commande($db); -if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0) +if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0) { dol_print_error($db); } @@ -153,13 +153,13 @@ if ($id > 0 || ! empty($ref)) // Affiche formulaire upload $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 $param='&id='.$commande->id; $formfile->list_of_documents($filearray,$commande,'commande',$param); - + } else { diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 106b92a697b..3b326dcdcc1 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -156,7 +156,7 @@ if ($facid > 0) // Affiche formulaire upload $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 diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 3a05d0913ef..0fdb81aba2d 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005 Regis Houssin * Copyright (C) 2005 Simon TOSSER @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + /** \file htdocs/contrat/document.php \ingroup contrat @@ -40,10 +40,10 @@ if (!$user->rights->contrat->lire) accessforbidden(); // Security check -if ($user->societe_id > 0) +if ($user->societe_id > 0) { unset($_GET["action"]); - $action=''; + $action=''; $socid = $user->societe_id; } @@ -97,7 +97,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) /* * */ - + $html = new Form($db); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -109,7 +109,7 @@ if ($contrat->id) $soc->fetch($contrat->societe->id); if ( $error_msg ) - { + { echo '
'.$error_msg.'

'; } @@ -132,8 +132,8 @@ if ($contrat->id) { $totalsize+=$file['size']; } - - + + print '
'; // Reference @@ -152,11 +152,11 @@ if ($contrat->id) // Affiche formulaire upload $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 - $param='&id='.$contrat->id; + $param='&id='.$contrat->id; $formfile->list_of_documents($filearray,$contrat,'contract',$param); } diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 61ddac78a59..75f9d9906a4 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -154,7 +154,7 @@ if ($object->id) // Affiche formulaire upload $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 diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 01a846959a7..4afd052d1be 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -203,7 +203,7 @@ if ($id > 0 || ! empty($ref)) // Affiche formulaire upload $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 diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index ed73039d757..fd3fe080c11 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005 Regis Houssin * @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/** \file htdocs/fourn/facture/document.php \ingroup facture, fournisseur \brief Page de gestion des documents attachées à une facture fournisseur @@ -44,10 +44,10 @@ $facid=empty($_GET['facid']) ? 0 : intVal($_GET['facid']); $action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; // Security check -if ($user->societe_id > 0) +if ($user->societe_id > 0) { unset($_GET["action"]); - $action=''; + $action=''; $socid = $user->societe_id; } @@ -68,7 +68,7 @@ $pagenext = $page + 1; /* * Actions */ - + // Envoi fichier if ($_POST['sendit'] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { @@ -78,7 +78,7 @@ if ($_POST['sendit'] && ! empty($conf->global->MAIN_UPLOAD_DOC)) $upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$facture->id; if (! is_dir($upload_dir)) create_exdir($upload_dir); - + if (is_dir($upload_dir)) { if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . '/' . $_FILES['userfile']['name'],0) > 0) @@ -116,7 +116,7 @@ if ($action=='delete') /* * Affichage */ - + llxHeader(); if ($facid > 0) @@ -139,7 +139,7 @@ if ($facid > 0) { $totalsize+=$file['size']; } - + print '
'; @@ -163,16 +163,16 @@ if ($facid > 0) if ($mesg) { print $mesg.'
'; } - + // Affiche formulaire upload $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 $param='&facid='.$facture->id; $formfile->list_of_documents($filearray,$facture,'facture_fournisseur',$param); - + } else { diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php index c6ce404a6d3..dd70b7247d5 100644 --- a/htdocs/html.formfile.class.php +++ b/htdocs/html.formfile.class.php @@ -51,9 +51,10 @@ class FormFile * \param titre Titre zone * \param addcancel 1=Ajoute un bouton 'Annuler' * \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 */ - 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; @@ -80,11 +81,11 @@ class FormFile print ''; } print 'global->MAIN_UPLOAD_DOC)?' disabled="true"':''); + print (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="true"':''); print '>'; print '   '; print 'global->MAIN_UPLOAD_DOC)?' disabled="true"':''); + print (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="true"':''); print '>'; if ($addcancel) @@ -95,9 +96,12 @@ class FormFile if (! empty($conf->global->MAIN_UPLOAD_DOC)) { - print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); - print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); - print ')'; + if ($perm) + { + print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); + print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); + print ')'; + } } else { diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 331f7db422e..424dfa035e6 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005 Regis Houssin * Copyright (C) 2005 Simon TOSSER @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + /** \file htdocs/product/document.php \ingroup product @@ -42,10 +42,10 @@ if (!$user->rights->produit->lire) $action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; // Security check -if ($user->societe_id > 0) +if ($user->societe_id > 0) { unset($_GET["action"]); - $action=''; + $action=''; $socid = $user->societe_id; } @@ -103,7 +103,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) /* * */ - + $html = new Form($db); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -112,7 +112,7 @@ llxHeader("","",$langs->trans("CardProduct".$product->type)); if ($product->id) { if ( $error_msg ) - { + { echo '
'.$error_msg.'

'; } @@ -135,8 +135,8 @@ if ($product->id) { $totalsize+=$file['size']; } - - + + print '
'; // Reference @@ -175,13 +175,13 @@ if ($product->id) // Affiche formulaire upload $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 $param='&id='.$product->id; $formfile->list_of_documents($filearray,$product,'produit',$param); - + } else { diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index dfbc5fd944f..1f04b5063c7 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -37,10 +37,10 @@ $mesg = ""; // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:(! empty($_GET["id"])?$_GET["id"]:''); -if ($user->societe_id > 0) +if ($user->societe_id > 0) { unset($_GET["action"]); - $action=''; + $action=''; $socid = $user->societe_id; } $result = restrictedArea($user, 'societe', $socid); @@ -74,7 +74,7 @@ $courrier_dir = $conf->societe->dir_output . "/courrier/" . get_exdir($socid) ; if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if (! is_dir($upload_dir)) create_exdir($upload_dir); - + if (is_dir($upload_dir)) { $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); @@ -121,11 +121,11 @@ if ($socid > 0) * Affichage onglets */ $head = societe_prepare_head($societe); - + $html=new Form($db); - + dol_fiche_head($head, 'document', $langs->trans("ThirdParty")); - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); @@ -134,28 +134,28 @@ if ($socid > 0) { $totalsize+=$file['size']; } - - + + print '
'; - + // Ref print ''; // Prefix print ''; - + // Nbre fichiers print ''; - + //Total taille print ''; - + print '
'.$langs->trans("Name").''.$societe->nom.'
'.$langs->trans('Prefix').''.$societe->prefix_comm.'
'.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - + print ''; - + if ($mesg) { print "$mesg
"; } - + /* * Confirmation de la suppression d'une ligne produit */ @@ -164,27 +164,27 @@ if ($socid > 0) $html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); print '
'; } - - + + // Affiche formulaire upload $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 $param='&socid='.$societe->id; $formfile->list_of_documents($filearray,$societe,'societe',$param); - - + + print "

"; - + // Courriers // Les courriers sont des documents speciaux generes par des scripts // situes dans scripts/courrier. // Voir Rodo if ($conf->global->MAIN_MODULE_EDITEUR) { - $filearray=array(); + $filearray=array(); $errorlevel=error_reporting(); error_reporting(0); $handle=opendir($courrier_dir); @@ -201,7 +201,7 @@ if ($socid > 0) } } closedir($handle); - } + } print ''; print '';
'.$langs->trans("Courriers").''.$langs->trans("Size").''.$langs->trans("Date").'