From 3cf3dbeb51cc8f37ef29fb8fea31f4aafb1c0424 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 9 Aug 2013 13:48:44 +0200 Subject: [PATCH] Add pdf link into supplier invoice list and supplier order list --- ChangeLog | 1 + htdocs/core/class/html.formactions.class.php | 2 +- htdocs/core/lib/functions2.lib.php | 48 +++++++++++++------- htdocs/fourn/commande/fiche.php | 10 ++++ htdocs/fourn/commande/liste.php | 10 +++- htdocs/fourn/facture/list.php | 6 +++ 6 files changed, 59 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index d83555879b3..bf9ac07542f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,7 @@ For users: - New: [ task #1016 ] Can define a specific numbering for deposits - New: [ task #918 ] Stock replenishment - Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count +- New : Add pdf link into supplier invoice list and supplier order list For translators: diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index ef8422a7dbc..43a06fead4e 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -144,7 +144,7 @@ class FormActions global $bc; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - + $listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement); if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions'); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 38558c2e5fe..428cddcf0ca 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1451,47 +1451,63 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='') // To work with non standard path if ($objecttype == 'facture' || $objecttype == 'invoice') { - $classpath = 'compta/facture/class'; $module='facture'; $subelement='facture'; + $classpath = 'compta/facture/class'; + $module='facture'; + $subelement='facture'; } if ($objecttype == 'commande' || $objecttype == 'order') { - $classpath = 'commande/class'; $module='commande'; $subelement='commande'; + $classpath = 'commande/class'; + $module='commande'; + $subelement='commande'; } if ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } if ($objecttype == 'shipping') { - $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; + $classpath = 'expedition/class'; + $subelement = 'expedition'; + $module = 'expedition_bon'; } if ($objecttype == 'delivery') { - $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; - } - if ($objecttype == 'invoice_supplier') { - $classpath = 'fourn/class'; - } - if ($objecttype == 'order_supplier') { - $classpath = 'fourn/class'; + $classpath = 'livraison/class'; + $subelement = 'livraison'; + $module = 'livraison_bon'; } if ($objecttype == 'contract') { - $classpath = 'contrat/class'; $module='contrat'; $subelement='contrat'; + $classpath = 'contrat/class'; + $module='contrat'; + $subelement='contrat'; } if ($objecttype == 'member') { - $classpath = 'adherents/class'; $module='adherent'; $subelement='adherent'; + $classpath = 'adherents/class'; + $module='adherent'; + $subelement='adherent'; } if ($objecttype == 'cabinetmed_cons') { - $classpath = 'cabinetmed/class'; $module='cabinetmed'; $subelement='cabinetmedcons'; + $classpath = 'cabinetmed/class'; + $module='cabinetmed'; + $subelement='cabinetmedcons'; } if ($objecttype == 'fichinter') { - $classpath = 'fichinter/class'; $module='ficheinter'; $subelement='fichinter'; + $classpath = 'fichinter/class'; + $module='ficheinter'; + $subelement='fichinter'; } //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement; $classfile = strtolower($subelement); $classname = ucfirst($subelement); if ($objecttype == 'invoice_supplier') { - $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; + $classfile = 'fournisseur.facture'; + $classname='FactureFournisseur'; + $classpath = 'fourn/class'; + $module='fournisseur'; } if ($objecttype == 'order_supplier') { - $classfile = 'fournisseur.commande'; $classname='CommandeFournisseur'; + $classfile = 'fournisseur.commande'; + $classname='CommandeFournisseur'; + $classpath = 'fourn/class'; + $module='fournisseur'; } if (! empty($conf->$module->enabled)) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 1e932d64827..1876d181339 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1812,6 +1812,16 @@ elseif (! empty($object->id)) * Linked object block */ $somethingshown=$object->showLinkedObjectBlock(); + + print '
'; + + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'order_supplier',$socid); + + print '
'; //print ''; print '
'; diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index 478bf76f86f..9715bb52ca7 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -23,9 +23,11 @@ * \brief List of suppliers orders */ + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $langs->load("orders"); @@ -65,6 +67,7 @@ if ($socid > 0) llxHeader('',$title); $commandestatic=new CommandeFournisseur($db); +$formfile = new FormFile($db); if ($sortorder == "") $sortorder="DESC"; @@ -154,6 +157,7 @@ if ($resql) $var=true; $userstatic = new User($db); + $objectstatic=new CommandeFournisseur($db); while ($i < min($num,$conf->liste_limit)) { @@ -163,7 +167,11 @@ if ($resql) print ""; // Ref - print ''.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.''."\n"; + print ''.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.''; + $filename=dol_sanitizeFileName($obj->ref); + $filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print ''."\n"; // Company print ''.img_object($langs->trans("ShowCompany"),"company").' '; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 80c20a821ba..820aaadb573 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013 Florian Henry * * 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 @@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; if (!$user->rights->fournisseur->facture->lire) accessforbidden(); @@ -99,6 +101,7 @@ if ($mode == 'search') $now=dol_now(); $form=new Form($db); $htmlother=new FormOther($db); +$formfile = new FormFile($db); llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); @@ -252,6 +255,9 @@ if ($resql) $facturestatic->ref=$obj->ref; $facturestatic->ref_supplier=$obj->ref_supplier; print $facturestatic->getNomUrl(1); + $filename=dol_sanitizeFileName($obj->ref); + $filedir=$conf->fournisseur->dir_output.'/facture' . '/' . dol_sanitizeFileName($obj->facid).'/0/'.dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print "\n"; print ''.dol_trunc($obj->ref_supplier,10).""; print ''.dol_print_date($db->jdate($obj->datef),'day').'';