Skip to content

Commit

Permalink
Merge pull request #1175 from FHenry/develop
Browse files Browse the repository at this point in the history
Add pdf link into supplier invoice list and supplier order list
  • Loading branch information
eldy committed Aug 9, 2013
2 parents ff4ebe4 + 0a8c7f7 commit 3502747
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 20 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -46,6 +46,8 @@ 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
- New : Genrate auto the PDF for supplier invoice


For translators:
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formactions.class.php
Expand Up @@ -144,7 +144,7 @@ function showactions($object,$typeelement,$socid=0,$forceshowtitle=0)
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');

Expand Down
48 changes: 32 additions & 16 deletions htdocs/core/lib/functions2.lib.php
Expand Up @@ -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))
Expand Down
10 changes: 10 additions & 0 deletions htdocs/fourn/commande/fiche.php
Expand Up @@ -1812,6 +1812,16 @@
* Linked object block
*/
$somethingshown=$object->showLinkedObjectBlock();

print '</div><div class="fichehalfright"><div class="ficheaddleft">';


// 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 '</div></div></div>';

//print '</td><td valign="top" width="50%">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
Expand Down
10 changes: 9 additions & 1 deletion htdocs/fourn/commande/liste.php
Expand Up @@ -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");

Expand Down Expand Up @@ -65,6 +67,7 @@
llxHeader('',$title);

$commandestatic=new CommandeFournisseur($db);
$formfile = new FormFile($db);


if ($sortorder == "") $sortorder="DESC";
Expand Down Expand Up @@ -154,6 +157,7 @@
$var=true;

$userstatic = new User($db);
$objectstatic=new CommandeFournisseur($db);

while ($i < min($num,$conf->liste_limit))
{
Expand All @@ -163,7 +167,11 @@
print "<tr ".$bc[$var].">";

// Ref
print '<td><a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.'</a></td>'."\n";
print '<td><a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.'</a>';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td>'."\n";

// Company
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' ';
Expand Down
32 changes: 30 additions & 2 deletions htdocs/fourn/facture/fiche.php
Expand Up @@ -28,6 +28,10 @@
* \brief Page for supplier invoice card (view, edit, validate)
*/

error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', false);

require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
Expand Down Expand Up @@ -456,6 +460,16 @@
else
{
$db->commit();

if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}

header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
Expand Down Expand Up @@ -608,7 +622,14 @@
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}

unset($_POST['qty']);
unset($_POST['type']);
Expand Down Expand Up @@ -659,7 +680,14 @@
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}

$action='';
}
Expand Down
6 changes: 6 additions & 0 deletions htdocs/fourn/facture/list.php
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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
Expand All @@ -29,6 +30,7 @@
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();

Expand Down Expand Up @@ -99,6 +101,7 @@
$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');

Expand Down Expand Up @@ -252,6 +255,9 @@
$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 "</td>\n";
print '<td class="nowrap">'.dol_trunc($obj->ref_supplier,10)."</td>";
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datef),'day').'</td>';
Expand Down

0 comments on commit 3502747

Please sign in to comment.