Fix Can't download generated document for cheque summary deposit.

This commit is contained in:
Laurent Destailleur 2015-08-27 22:43:09 +02:00
parent ddb9c6a025
commit 302b61c5ce
3 changed files with 13 additions and 17 deletions

View File

@ -88,10 +88,6 @@ if ($action == 'setdate' && $user->rights->banque->cheque)
} }
} }
/*
* Actions
*/
if ($action == 'setrefext' && $user->rights->banque->cheque) if ($action == 'setrefext' && $user->rights->banque->cheque)
{ {
$result = $object->fetch(GETPOST('id','int')); $result = $object->fetch(GETPOST('id','int'));
@ -282,7 +278,7 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque)
$langs->load("other"); $langs->load("other");
$file=$dir.get_exdir($object->number,2,1,0,$object,'cheque') . GETPOST('file'); $file=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object); $ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
@ -655,7 +651,6 @@ else
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$i=1; $i=1;
$var=false; $var=false;
@ -751,7 +746,7 @@ if ($action != 'new')
if ($object->statut == 1) if ($object->statut == 1)
{ {
$filename=dol_sanitizeFileName($object->ref); $filename=dol_sanitizeFileName($object->ref);
$filedir=$dir.get_exdir($object->number,2,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref); $filedir=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref);
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1); $formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);

View File

@ -548,7 +548,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8. // output format that does not support UTF8.
$sav_charseSupprimert_output=$outputlangs->charset_output; $sav_charseSupprimert_output=$outputlangs->charset_output;
$result=$docmodel->write_file($conf->banque->dir_output.'/bordereau', $this->number, $outputlangs); $result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
if ($result > 0) if ($result > 0)
{ {
//$outputlangs->charset_output=$sav_charset_output; //$outputlangs->charset_output=$sav_charset_output;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@ -76,14 +76,15 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
} }
/** /**
* Fonction generant le rapport sur le disque * Fonction to generate document on disk
* *
* @param string $_dir Directory * @param RemiseCheque $object Object RemiseCheque
* @param string $number Number * @param string $_dir Directory
* @param Translate $outputlangs Lang output object * @param string $number Number
* @return int 1=ok, 0=ko * @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko
*/ */
function write_file($_dir, $number, $outputlangs) function write_file($object, $_dir, $number, $outputlangs)
{ {
global $user,$conf,$langs,$hookmanager; global $user,$conf,$langs,$hookmanager;
@ -98,7 +99,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$outputlangs->load("products"); $outputlangs->load("products");
$outputlangs->load("compta"); $outputlangs->load("compta");
$dir = $_dir . "/".get_exdir($number,2,1,0,null,'cheque').$number; $dir = $_dir . "/".get_exdir($number,0,1,0,$object,'cheque').$number;
if (! is_dir($dir)) if (! is_dir($dir))
{ {