Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
9e6a9f1b12
@ -76,6 +76,10 @@ class FileUpload
|
|||||||
elseif ($element == 'order_supplier') {
|
elseif ($element == 'order_supplier') {
|
||||||
$pathname = 'fourn'; $filename='fournisseur.commande';
|
$pathname = 'fourn'; $filename='fournisseur.commande';
|
||||||
$dir_output=$conf->fournisseur->commande->dir_output;
|
$dir_output=$conf->fournisseur->commande->dir_output;
|
||||||
|
}
|
||||||
|
elseif ($element == 'invoice_supplier') {
|
||||||
|
$pathname = 'fourn'; $filename='fournisseur.facture';
|
||||||
|
$dir_output=$conf->fournisseur->facture->dir_output;
|
||||||
} else {
|
} else {
|
||||||
$dir_output=$conf->$element->dir_output;
|
$dir_output=$conf->$element->dir_output;
|
||||||
}
|
}
|
||||||
@ -86,6 +90,8 @@ class FileUpload
|
|||||||
|
|
||||||
if ($element == 'order_supplier') {
|
if ($element == 'order_supplier') {
|
||||||
$classname = 'CommandeFournisseur';
|
$classname = 'CommandeFournisseur';
|
||||||
|
} elseif ($element == 'invoice_supplier') {
|
||||||
|
$classname = 'FactureFournisseur';
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new $classname($db);
|
$object = new $classname($db);
|
||||||
@ -93,10 +99,15 @@ class FileUpload
|
|||||||
$object->fetch($fk_element);
|
$object->fetch($fk_element);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
|
$object_ref = dol_sanitizeFileName($object->ref);
|
||||||
|
if ($element == 'invoice_supplier') {
|
||||||
|
$object_ref = get_exdir($object->id, 2) . $object_ref;
|
||||||
|
}
|
||||||
|
|
||||||
$this->options = array(
|
$this->options = array(
|
||||||
'script_url' => $_SERVER['PHP_SELF'],
|
'script_url' => $_SERVER['PHP_SELF'],
|
||||||
'upload_dir' => $dir_output . '/' . $object->ref . '/',
|
'upload_dir' => $dir_output . '/' . $object_ref . '/',
|
||||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object->ref.'/',
|
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object_ref.'/',
|
||||||
'param_name' => 'files',
|
'param_name' => 'files',
|
||||||
// Set the following option to 'POST', if your server does not support
|
// Set the following option to 'POST', if your server does not support
|
||||||
// DELETE requests. This is a parameter sent to the client:
|
// DELETE requests. This is a parameter sent to the client:
|
||||||
@ -129,8 +140,8 @@ class FileUpload
|
|||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
'thumbnail' => array(
|
'thumbnail' => array(
|
||||||
'upload_dir' => $dir_output . '/' . $object->ref . '/thumbs/',
|
'upload_dir' => $dir_output . '/' . $object_ref . '/thumbs/',
|
||||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object->ref.'/thumbs/',
|
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object_ref.'/thumbs/',
|
||||||
'max_width' => 80,
|
'max_width' => 80,
|
||||||
'max_height' => 80
|
'max_height' => 80
|
||||||
)
|
)
|
||||||
|
|||||||
@ -584,34 +584,73 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';';
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';';
|
||||||
dol_syslog("FactureFournisseur sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE rowid = '.$rowid;
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE rowid = '.$rowid;
|
||||||
dol_syslog("FactureFournisseur sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||||
$resql2 = $this->db->query($sql);
|
$resql2 = $this->db->query($sql);
|
||||||
if (! $resql2) $error++;
|
if (! $resql2) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
// Appel des triggers
|
||||||
return 1;
|
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||||
}
|
$interface=new Interfaces($this->db);
|
||||||
else
|
$result=$interface->run_triggers('INVOICE_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
||||||
{
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$error++; $this->errors=$interface->errors;
|
||||||
$this->error=$this->db->lasterror();
|
}
|
||||||
dol_syslog("FactureFournisseur::delete ".$this->error, LOG_ERR);
|
// Fin appel triggers
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
// We remove directory
|
||||||
|
if ($conf->fournisseur->facture->dir_output)
|
||||||
|
{
|
||||||
|
$ref = dol_sanitizeFileName($this->ref);
|
||||||
|
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2).$ref;
|
||||||
|
$file = $dir . "/" . $ref . ".pdf";
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
|
||||||
|
{
|
||||||
|
$this->error='ErrorFailToDeleteFile';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (file_exists($dir))
|
||||||
|
{
|
||||||
|
$res=@dol_delete_dir_recursive($dir);
|
||||||
|
if (! $res)
|
||||||
|
{
|
||||||
|
$this->error='ErrorFailToDeleteDir';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG);
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->error=$this->db->lasterror();
|
||||||
$this->error=$this->db->lasterror();
|
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||||
dol_syslog("FactureFournisseur::delete ".$this->error, LOG_ERR);
|
$this->db->rollback();
|
||||||
return -1;
|
return -$error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 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-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/fourn/facture/document.php
|
* \file htdocs/fourn/facture/document.php
|
||||||
@ -36,8 +36,9 @@ $langs->load('bills');
|
|||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$facid = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
|
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
|
||||||
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action'];
|
$action=GETPOST('action','alpha');
|
||||||
|
$confirm=GETPOST('confirm','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@ -57,6 +58,12 @@ if (! $sortorder) $sortorder="ASC";
|
|||||||
if (! $sortfield) $sortfield="name";
|
if (! $sortfield) $sortfield="name";
|
||||||
|
|
||||||
$object = new FactureFournisseur($db);
|
$object = new FactureFournisseur($db);
|
||||||
|
if ($object->fetch($id))
|
||||||
|
{
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
$ref=dol_sanitizeFileName($object->ref);
|
||||||
|
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -66,43 +73,24 @@ $object = new FactureFournisseur($db);
|
|||||||
// Envoi fichier
|
// Envoi fichier
|
||||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
if ($object->id > 0) {
|
||||||
|
dol_add_file_process($upload_dir, 0, 1, 'userfile');
|
||||||
$facture = new FactureFournisseur($db);
|
|
||||||
if ($facture->fetch($facid))
|
|
||||||
{
|
|
||||||
$ref=dol_sanitizeFileName($facture->ref);
|
|
||||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref;
|
|
||||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($action=='delete')
|
else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
$facid=$_GET['id'];
|
if ($object->id > 0)
|
||||||
|
{
|
||||||
$facture = new FactureFournisseur($db);
|
$langs->load("other");
|
||||||
if ($facture->fetch($facid))
|
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
{
|
$ret=dol_delete_file($file,0,0,0,$object);
|
||||||
$langs->load("other");
|
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||||
$ref=dol_sanitizeFileName($facture->ref);
|
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref;
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
|
exit;
|
||||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
}
|
||||||
$ret=dol_delete_file($file);
|
|
||||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
|
||||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set label
|
|
||||||
if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
|
|
||||||
{
|
|
||||||
$object->fetch($facid);
|
|
||||||
$object->label=$_POST['label'];
|
|
||||||
$result=$object->update($user);
|
|
||||||
if ($result < 0) dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,119 +102,113 @@ $form = new Form($db);
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
if ($facid > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
if ($object->fetch($facid))
|
$head = facturefourn_prepare_head($object);
|
||||||
{
|
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill');
|
||||||
$object->fetch_thirdparty();
|
|
||||||
|
|
||||||
$ref=dol_sanitizeFileName($object->ref);
|
// Construit liste des fichiers
|
||||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref;
|
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||||
|
$totalsize=0;
|
||||||
|
foreach($filearray as $key => $file)
|
||||||
|
{
|
||||||
|
$totalsize+=$file['size'];
|
||||||
|
}
|
||||||
|
|
||||||
$head = facturefourn_prepare_head($object);
|
/*
|
||||||
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill');
|
* Confirm delete file
|
||||||
|
*/
|
||||||
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
|
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||||
|
if ($ret == 'html') print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||||
|
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Ref supplier
|
||||||
|
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Thirdparty
|
||||||
|
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||||
|
|
||||||
|
// Type
|
||||||
|
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
|
||||||
|
print $object->getLibType();
|
||||||
|
if ($object->type == 1)
|
||||||
|
{
|
||||||
|
$facreplaced=new FactureFournisseur($db);
|
||||||
|
$facreplaced->fetch($object->fk_facture_source);
|
||||||
|
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
|
||||||
|
}
|
||||||
|
if ($object->type == 2)
|
||||||
|
{
|
||||||
|
$facusing=new FactureFournisseur($db);
|
||||||
|
$facusing->fetch($object->fk_facture_source);
|
||||||
|
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$facidavoir=$object->getListIdAvoirFromInvoice();
|
||||||
|
if (count($facidavoir) > 0)
|
||||||
|
{
|
||||||
|
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||||
|
$i=0;
|
||||||
|
foreach($facidavoir as $id)
|
||||||
|
{
|
||||||
|
if ($i==0) print ' ';
|
||||||
|
else print ',';
|
||||||
|
$facavoir=new FactureFournisseur($db);
|
||||||
|
$facavoir->fetch($id);
|
||||||
|
print $facavoir->getNomUrl(1);
|
||||||
|
}
|
||||||
|
print ')';
|
||||||
|
}
|
||||||
|
if ($facidnext > 0)
|
||||||
|
{
|
||||||
|
$facthatreplace=new FactureFournisseur($db);
|
||||||
|
$facthatreplace->fetch($facidnext);
|
||||||
|
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("Label",'label',$object->label,$object,0);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Nb of files
|
||||||
|
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// Affiche formulaire upload
|
||||||
|
$formfile=new FormFile($db);
|
||||||
|
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer, 50, $object);
|
||||||
|
|
||||||
|
|
||||||
// Construit liste des fichiers
|
// List of document
|
||||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
$param='&facid='.$object->id;
|
||||||
$totalsize=0;
|
$formfile->list_of_documents($filearray,$object,'facture_fournisseur',$param,0,get_exdir($object->id,2,0).$object->id.'/');
|
||||||
foreach($filearray as $key => $file)
|
|
||||||
{
|
|
||||||
$totalsize+=$file['size'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
// Ref
|
|
||||||
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
|
|
||||||
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
|
||||||
print '</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
// Ref supplier
|
|
||||||
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
// Thirdparty
|
|
||||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
|
||||||
|
|
||||||
// Type
|
|
||||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
|
|
||||||
print $object->getLibType();
|
|
||||||
if ($object->type == 1)
|
|
||||||
{
|
|
||||||
$facreplaced=new FactureFournisseur($db);
|
|
||||||
$facreplaced->fetch($object->fk_facture_source);
|
|
||||||
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
|
|
||||||
}
|
|
||||||
if ($object->type == 2)
|
|
||||||
{
|
|
||||||
$facusing=new FactureFournisseur($db);
|
|
||||||
$facusing->fetch($object->fk_facture_source);
|
|
||||||
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
|
|
||||||
}
|
|
||||||
|
|
||||||
$facidavoir=$object->getListIdAvoirFromInvoice();
|
|
||||||
if (count($facidavoir) > 0)
|
|
||||||
{
|
|
||||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
|
||||||
$i=0;
|
|
||||||
foreach($facidavoir as $id)
|
|
||||||
{
|
|
||||||
if ($i==0) print ' ';
|
|
||||||
else print ',';
|
|
||||||
$facavoir=new FactureFournisseur($db);
|
|
||||||
$facavoir->fetch($id);
|
|
||||||
print $facavoir->getNomUrl(1);
|
|
||||||
}
|
|
||||||
print ')';
|
|
||||||
}
|
|
||||||
if ($facidnext > 0)
|
|
||||||
{
|
|
||||||
$facthatreplace=new FactureFournisseur($db);
|
|
||||||
$facthatreplace->fetch($facidnext);
|
|
||||||
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Label
|
|
||||||
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
|
|
||||||
print $form->editfieldval("Label",'label',$object->label,$object,0);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Nb of files
|
|
||||||
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
// Affiche formulaire upload
|
|
||||||
$formfile=new FormFile($db);
|
|
||||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer,50,$object);
|
|
||||||
|
|
||||||
|
|
||||||
// List of document
|
|
||||||
$param='&facid='.$object->id;
|
|
||||||
$formfile->list_of_documents($filearray,$object,'facture_fournisseur',$param,0,get_exdir($object->id,2,0).$object->id.'/');
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print 'facid='.$facid.'<br>';
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans('UnkownError');
|
print $langs->trans('UnkownError');
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
@ -126,6 +126,7 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni
|
|||||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->facture->supprimer)
|
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->facture->supprimer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
$object->fetch_thirdparty();
|
||||||
$result=$object->delete($id);
|
$result=$object->delete($id);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -796,6 +797,7 @@ elseif ($action == 'builddoc')
|
|||||||
{
|
{
|
||||||
// Save modele used
|
// Save modele used
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
$object->fetch_thirdparty();
|
||||||
if ($_REQUEST['model'])
|
if ($_REQUEST['model'])
|
||||||
{
|
{
|
||||||
$object->setDocModel($user, $_REQUEST['model']);
|
$object->setDocModel($user, $_REQUEST['model']);
|
||||||
@ -827,9 +829,10 @@ elseif ($action == 'remove_file')
|
|||||||
|
|
||||||
if ($object->fetch($id))
|
if ($object->fetch($id))
|
||||||
{
|
{
|
||||||
|
$object->fetch_thirdparty();
|
||||||
$upload_dir = $conf->fournisseur->facture->dir_output . "/";
|
$upload_dir = $conf->fournisseur->facture->dir_output . "/";
|
||||||
$file = $upload_dir . '/' . GETPOST('file');
|
$file = $upload_dir . '/' . GETPOST('file');
|
||||||
$ret=dol_delete_file($file);
|
$ret=dol_delete_file($file,0,0,0,$object);
|
||||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user