diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php deleted file mode 100644 index cdeacefafe1..00000000000 --- a/htdocs/comm/propal/apercu.php +++ /dev/null @@ -1,224 +0,0 @@ - - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2014 Frederic France - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/comm/propal/apercu.php - * \ingroup propal - * \brief Preview tab of propal - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - -$langs->load('propal'); -$langs->load("bills"); -$langs->load('compta'); - -// Security check -$socid=0; -$id = GETPOST('id','int'); -$ref = GETPOST("ref"); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'propal', $id); - - -/* - * View Mode - */ - -$form = new Form($db); - -llxHeader(); - -if ($id > 0 || ! empty($ref)) -{ - $object = new Propal($db); - - if ($object->fetch($id,$ref) > 0) - { - $soc = new Societe($db); - $soc->fetch($object->socid); - - $head = propal_prepare_head($object); - dol_fiche_head($head, 'preview', $langs->trans('Proposal'), 0, 'propal'); - - - /* - * Propal - */ - print ''; - - $linkback = '' . $langs->trans("BackToList") . ''; - - // Ref - print ''; - - // Ref client - print ''; - print ''; - print ''; - - - // Thirdparty - print ''; - print ''; - print ''; - - // Status - print ''; - print ''; - print ''; - - // Discount - print ''; - print ''; - - // Date - print ''; - print ''; - - // Right part with $rowspan lines - $rowspan=4; - print ''; - print ''; - - // Total HT - left part - print ''; - print ''; - print ''; - - // Total VAT - left part - print ''; - print ''; - print ''; - - // Total TTC - left part - print ''; - print ''; - print ''; - - print '
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Discounts').''; - if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount=$soc->getAvailableDiscounts(); - print '. '; - if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency)); - else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.
'.$langs->trans('Date').''.dol_print_date($object->date,'daytext').''; - - /* - * Documents - */ - $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->propal->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; - $file = $filepath . $objectref . ".pdf"; - $filedetail = $filepath . $objectref . "-detail.pdf"; - $relativepath = $objectref.'/'.$objectref.'.pdf'; - $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; - - // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page - $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page - $relativepathimage = $relativepath.'_preview.png'; - - $var=true; - - // Si fichier PDF existe - if (file_exists($file)) - { - $encfile = urlencode($file); - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print ''; - print ''; - - print "
'.$langs->trans("Documents").'
'.$langs->trans("Proposal").' PDF'.$object->ref.'.pdf'.dol_print_size(dol_filesize($file)).''.dol_print_date(dol_filemtime($file),'dayhour').'
\n"; - - // Conversion du PDF en image png si fichier png non existant - if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) - { - if (class_exists("Imagick")) - { - $ret = dol_convert_file($file,'png',$fileimage); - if ($ret < 0) $error++; - } - else - { - $langs->load("errors"); - print ''.$langs->trans("ErrorNoImagickReadimage").''; - } - } - } - - print '
'.$langs->trans('AmountHT').'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; - - dol_fiche_end(); - } - else - { - // Propal non trouvee - print $langs->trans("ErrorPropalNotFound",$_GET["id"]); - } -} - -print ''; -print ''; -print '
'; -print '
'; -// Si fichier png PDF d'1 page trouve -if (file_exists($fileimage)) -{ - print ''; -} -// Si fichier png PDF de plus d'1 page trouve -elseif (file_exists($fileimagebis)) -{ - $multiple = preg_replace('/\.png/','',$relativepath) . "-"; - - for ($i = 0; $i < 20; $i++) - { - $preview = $multiple.$i.'.png'; - - if (file_exists($dir_output.$preview)) - { - print '

'; - } - } -} -print '

'; -print '
'; - - -llxFooter(); - -$db->close(); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 810d6bd1abb..9b70ee36ace 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1675,7 +1675,7 @@ if ($action == 'create') $soc->fetch($object->socid); $head = propal_prepare_head($object); - dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); + dol_fiche_head($head, 'comm', $langs->trans('Proposal'), -1, 'propal'); $formconfirm = ''; @@ -1804,42 +1804,7 @@ if ($action == 'create') print ''; - // Ref - /* - print ''; - */ - - // Ref customer - /* - print ''; - print ''; - */ - - // Company - /* - print ''; - print '';*/ - - // Lin for thirdparty discounts + // Link for thirdparty discounts print '
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'; - print ''; - if ($action != 'refclient' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('RefCustomer') . '' . img_edit($langs->trans('Modify')) . '
'; - print '
'; - if ($user->rights->propal->creer && $action == 'refclient') { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } else { - print $object->ref_client; - } - print '
' . $langs->trans('Company') . '' . $soc->getNomUrl(1) . '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 8588bfc5749..3c3aa6aef88 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -151,7 +151,7 @@ $formother = new FormOther($db); if ($object->id > 0) { $head = propal_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("Proposal"), 0, 'propal'); + dol_fiche_head($head, 'contact', $langs->trans("Proposal"), -1, 'propal'); // Proposal card diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 9b875e434f7..82978daf2c1 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -89,7 +89,7 @@ if ($object->id > 0) $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); $head = propal_prepare_head($object); - dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); + dol_fiche_head($head, 'document', $langs->trans('Proposal'), -1, 'propal'); // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 14a4911b80f..d8af8fb87a8 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -59,7 +59,7 @@ llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_c $object->fetch_thirdparty(); $head = propal_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal'); +dol_fiche_head($head, 'info', $langs->trans('Proposal'), -1, 'propal'); $object->info($object->id); diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 57181b83f6b..ec1dac31c24 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch_thirdparty() > 0) { $head = propal_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal'); + dol_fiche_head($head, 'note', $langs->trans('Proposal'), -1, 'propal'); $cssclass='titlefield'; //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php deleted file mode 100644 index 1ec3a0533cc..00000000000 --- a/htdocs/commande/apercu.php +++ /dev/null @@ -1,223 +0,0 @@ - - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2014 Frederic France - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/commande/apercu.php - * \ingroup commande - * \brief Preview tab of order - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - -$langs->load('orders'); -$langs->load("bills"); -$langs->load('compta'); - -// Security check -$socid=0; -$id = GETPOST('id','int'); -$ref = GETPOST("ref"); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'commande',$id,''); - - -/* - * View Mode - */ - -$form = new Form($db); - -llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); - -if ($id > 0 || ! empty($ref)) -{ - $object = new Commande($db); - - if ($object->fetch($id,$ref) > 0) - { - $soc = new Societe($db); - $soc->fetch($object->socid); - - - $head = commande_prepare_head($object); - dol_fiche_head($head, 'preview', $langs->trans("CustomerOrder"), 0, 'order'); - - print ''; - - //$linkback = '' . $langs->trans("BackToList") . ''; - - // Ref - print ''; - - // Ref cde client - print ''; - print ''; - print ''; - - // Client - print ''; - print ''; - print ''; - - // Statut - print ''; - print ''; - print ''; - - // Discount - left part - print ''; - print ''; - print ''; - - // Date - left part - print ''; - print ''; - - // Right part with $rowspan lines - $rowspan=4; - print ''; - - // Total HT - left part - print ''; - print ''; - print ''; - - // Total VAT - left part - print ''; - print ''; - print ''; - - // Total TTC - left part - print ''; - print ''; - print ''; - - print '
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Discounts').''.$object->remise_percent.'%
'.$langs->trans("Date").''.dol_print_date($object->date,"daytext").''; - - /* - * Documents - */ - $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->commande->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; - $file = $filepath . $objectref . ".pdf"; - $filedetail = $filepath . $objectref . "-detail.pdf"; - $relativepath = $objectref.'/'.$objectref.'.pdf'; - $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; - - // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page - $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page - $relativepathimage = $relativepath.'_preview.png'; - - $var=true; - - // if PDF file exist - if (file_exists($file)) - { - $encfile = urlencode($file); - print ''; - print ''; - - print ""; - - print ''; - print ''; - print ''; - print ''; - - // Si fichier detail PDF existe - // TODO deprecated ? - if (file_exists($filedetail)) - { - print ""; - - print ''; - print ''; - print ''; - print ''; - } - print "
'.$langs->trans("Documents").'
".$langs->trans("Order")." PDF'.$object->ref.'.pdf'.dol_print_size(dol_filesize($file)).''.dol_print_date(dol_filemtime($file),'dayhour').'
Commande detaillee'.$object->ref.'-detail.pdf'.dol_print_size(dol_filesize($filedetail)).''.dol_print_date(dol_filemtime($filedetail),'dayhour').'
\n"; - - // Conversion du PDF en image png si fichier png non existant - if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) - { - if (class_exists("Imagick")) - { - $ret = dol_convert_file($file,'png',$fileimage); - if ($ret < 0) $error++; - } - else - { - $langs->load("errors"); - print ''.$langs->trans("ErrorNoImagickReadimage").''; - } - } - } - - print '
'.$langs->trans('AmountHT').'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; - - dol_fiche_end(); - } - else - { - // Object not found - print $langs->trans("ErrorOrderNotFound",$id); - } -} - -print ''; -print ''; -print '
'; -print '
'; -// Si fichier png PDF d'1 page trouve -if (file_exists($fileimage)) -{ - print ''; -} -// Si fichier png PDF de plus d'1 page trouve -elseif (file_exists($fileimagebis)) -{ - $multiple = preg_replace('/\.png/','',$relativepath) . "-"; - - for ($i = 0; $i < 20; $i++) - { - $preview = $multiple.$i.'.png'; - - if (file_exists($dir_output.$preview)) - { - print '

'; - } - } -} -print '

'; -print '
'; - - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php deleted file mode 100644 index b22571ad93f..00000000000 --- a/htdocs/compta/facture/apercu.php +++ /dev/null @@ -1,392 +0,0 @@ - - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2014 Frederic France - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * \file htdocs/compta/facture/apercu.php - * \ingroup facture - * \brief Preview Tab of invoice - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - -$langs->load("bills"); - -// Security check -$socid=0; -$id = GETPOST('facid','int'); -$ref = GETPOST("ref"); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'facture', $id); - - -/* - * View - */ - -$now=dol_now(); - -$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Preview'); -$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; -llxHeader('', $title, $helpurl); - -$form = new Form($db); - -/* *************************************************************************** */ -/* */ -/* Mode fiche */ -/* */ -/* *************************************************************************** */ - -if ($id > 0 || ! empty($ref)) -{ - $object = New Facture($db); - - if ($object->fetch($id,$ref) > 0) - { - $soc = new Societe($db); - $soc->fetch($object->socid); - - $head = facture_prepare_head($object); - dol_fiche_head($head, 'preview', $langs->trans("InvoiceCustomer"), 0, 'bill'); - - - $totalpaye = $object->getSommePaiement(); - - /* - * Invoice - */ - print ''; - - $linkback = '' . $langs->trans("BackToList") . ''; - - // Ref - print ''; - - // Ref customer - print ''; - print ''; - print ''; - - // Thirdparty - print ''; - print ''; - print ''; - - // Type - print ''; - print ''; - print ''; - - // Relative and absolute discounts - $addabsolutediscount=' '.$langs->trans("AddGlobalDiscount").''; - $addcreditnote=' '.$langs->trans("AddCreditNote").''; - - print ''; - print ''; - print ''; - - // Dates - print ''; - print ''; - - // Right part with $rowspan lines - $rowspan=5; - if (! empty($conf->projet->enabled)) $rowspan++; - print '"; - - // Total HT - print ''; - print ''; - print ''; - - // Total VAT - print ''; - print ''; - print ''; - - // Total TTC - print ''; - print ''; - print ''; - - // Statut - print ''; - print ''; - print ''; - - // Projet - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - print ''; - print ''; - } - - print '
' . $langs->trans('Ref') . ''; - $morehtmlref = ''; - $discount = new DiscountAbsolute($db); - $result = $discount->fetch(0, $object->id); - if ($result > 0) { - $morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')'; - } - if ($result < 0) { - dol_print_error('', $discount->error); - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans("Company").''.$soc->getNomUrl(1,'compta').'
'.$langs->trans('Type').''; - print $object->getLibType(); - if ($object->type == Facture::TYPE_REPLACEMENT) - { - $facreplaced=new Facture($db); - $facreplaced->fetch($object->fk_facture_source); - print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; - } - if ($object->type == Facture::TYPE_CREDIT_NOTE) - { - $facusing=new Facture($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 Facture($db); - $facavoir->fetch($id); - print $facavoir->getNomUrl(1); - } - print ')'; - } - if ($objectidnext > 0) - { - $facthatreplace=new Facture($db); - $facthatreplace->fetch($objectidnext); - print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; - } - print '
'.$langs->trans('Discounts').''; - if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - - if ($absolute_discount > 0) - { - print '. '; - if ($object->statut > Facture::STATUS_DRAFT || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) - { - if ($object->statut == Facture::STATUS_DRAFT) - { - print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - print '. '; - } - else - { - if ($object->statut < Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) - { - $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - print '
'.$text.'.
'; - } - else - { - $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - $text2=$langs->trans("AbsoluteDiscountUse"); - print $form->textwithpicto($text,$text2); - } - } - } - else - { - // Remise dispo de type remise fixe (not credit note) - $filter='fk_facture_source IS NULL'; - print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount, 1); - } - } - else - { - if ($absolute_creditnote > 0) // If not linked will be added later - { - if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'
'; - else print '.'; - } - else print '. '; - } - if ($absolute_creditnote > 0) - { - // If validated, we show link "add credit note to payment" - if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) - { - if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_DEPOSIT) - { - $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)); - print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse")); - } - else - { - print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.'; - } - } - else - { - // Remise dispo de type avoir - $filter='fk_facture_source IS NOT NULL'; - if (! $absolute_discount) print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer, '', 1); - } - } - if (! $absolute_discount && ! $absolute_creditnote) - { - print $langs->trans("CompanyHasNoAbsoluteDiscount"); - if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'
'; - else print '. '; - } - /*if ($object->statut == 0 && $object->type != 2 && $object->type != 3) - { - if (! $absolute_discount && ! $absolute_creditnote) print '
'; - //print '   -   '; - print $addabsolutediscount; - //print '   -   '.$addcreditnote; // We disbale link to credit note - }*/ - print '
'.$langs->trans("DateInvoice").''.dol_print_date($object->date,"daytext").''; - - /* - * Documents - */ - $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->facture->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; - $file = $filepath . $objectref . ".pdf"; - $filedetail = $filepath . $objectref . "-detail.pdf"; - $relativepath = $objectref.'/'.$objectref.'.pdf'; - $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; - - // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page - $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page - $relativepathimage = $relativepath.'_preview.png'; - - $var=true; - - // Si fichier PDF existe - if (file_exists($file)) - { - $encfile = urlencode($file); - print ''; - print ''; - - print ""; - - print ''; - print ''; - print ''; - print ''; - - // Si fichier detail PDF existe - if (file_exists($filedetail)) // facture detaillee supplementaire - { - print ""; - - print ''; - print ''; - print ''; - print ''; - } - - print "
'.$langs->trans("Documents").'
".$langs->trans("Bill")." PDF'.$object->ref.'.pdf'.dol_print_size(dol_filesize($file)). ''.dol_print_date(dol_filemtime($file),'dayhour').'
Facture detaillee'.$object->ref.'-detail.pdf'.dol_print_size(dol_filesize($filedetail)).''.dol_print_date(dol_filemtime($filedetail),'dayhour').'
\n"; - - // Conversion du PDF en image png si fichier png non existant - if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) - { - if (class_exists("Imagick")) - { - $ret = dol_convert_file($file,'png',$fileimage); - if ($ret < 0) $error++; - } - else - { - $langs->load("errors"); - print ''.$langs->trans("ErrorNoImagickReadimage").''; - } - } - } - print "
'.$langs->trans("AmountHT").'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'.$langs->trans("Project").''; - if ($object->fk_project > 0) - { - $project = New Project($db); - $project->fetch($object->fk_project); - print ''.$project->title.''; - } - else - { - print ' '; - } - print '
'; - - dol_fiche_end(); - } - else - { - // Facture non trouvee - print $langs->trans("ErrorBillNotFound",$id); - } -} - -print ''; -print ''; -print '
'; -print '
'; -// Si fichier png PDF d'1 page trouve -if (file_exists($fileimage)) -{ - print ''; -} -// Si fichier png PDF de plus d'1 page trouve -elseif (file_exists($fileimagebis)) -{ - $multiple = preg_replace('/\.png/','',$relativepath) . "-"; - - for ($i = 0; $i < 20; $i++) - { - $preview = $multiple.$i.'.png'; - - if (file_exists($dir_output.$preview)) - { - print '

'; - } - } -} -print '

'; -print '
'; - -llxFooter(); - -$db->close(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 21c3b5dbcfe..315e920947d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6028,13 +6028,13 @@ class Form */ global $dolibarr_main_url_root; $ret.=''; - $ret.='Gravatar avatar'; // gravatar need md5 hash + $ret.='Gravatar avatar'; // gravatar need md5 hash } else { if ($conf->browser->layout != 'phone') { - $ret.='No photo'; + $ret.='No photo'; } } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a872d166283..dd2d9a00a50 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1006,12 +1006,15 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; $modulepart='unknown'; - if ($object->element == 'societe') $modulepart='societe'; - if ($object->element == 'contact') $modulepart='contact'; - if ($object->element == 'member') $modulepart='memberphoto'; - if ($object->element == 'user') $modulepart='userphoto'; - if ($object->element == 'product') $modulepart='product'; - + if ($object->element == 'societe') $modulepart='societe'; + if ($object->element == 'contact') $modulepart='contact'; + if ($object->element == 'member') $modulepart='memberphoto'; + if ($object->element == 'user') $modulepart='userphoto'; + if ($object->element == 'product') $modulepart='product'; + if ($object->element == 'propal') $modulepart='propal'; + if ($object->element == 'commande') $modulepart='commande'; + if ($object->element == 'facture') $modulepart='facture'; + if ($object->element == 'product') { $width=80; $cssclass='photoref'; @@ -1037,7 +1040,56 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { if ($modulepart != 'unknown') { - $phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); + // Check if a preview file is available + if (in_array($modulepart, array('propal', 'commande', 'facture')) && class_exists("Imagick")) + { + $objectref = dol_sanitizeFileName($object->ref); + $dir_output = $conf->$modulepart->dir_output . "/"; + $filepath = $dir_output . $objectref . "/"; + $file = $filepath . $objectref . ".pdf"; + $relativepath = $objectref.'/'.$objectref.'.pdf'; + + // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") + $fileimage = $file.'_preview.png'; // If PDF has 1 page + $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page + $relativepathimage = $relativepath.'_preview.png'; + + // Si fichier PDF existe + if (file_exists($file)) + { + $encfile = urlencode($file); + // Conversion du PDF en image png si fichier png non existant + if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) + { + $ret = dol_convert_file($file,'png',$fileimage); + if ($ret < 0) $error++; + } + + // Si fichier png PDF d'1 page trouve + if (file_exists($fileimage)) + { + $phototoshow = '
'; + $phototoshow.= ''; + $phototoshow.= '
'; + } + // Si fichier png PDF de plus d'1 page trouve + elseif (file_exists($fileimagebis)) + { + $preview = preg_replace('/\.png/','',$relativepath) . "-0.png"; + if (file_exists($dir_output.$preview)) + { + $phototoshow = '
'; + $phototoshow.= '

'; + $phototoshow.= '

'; + } + } + } + } + else if (! $phototoshow) + { + $phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); + } + if ($phototoshow) { $morehtmlleft.='
'; @@ -1045,7 +1097,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlleft.='
'; } } - elseif ($conf->browser->layout != 'phone') // Show No photo link (picto of pbject) + + if (! $phototoshow && $conf->browser->layout != 'phone') // Show No photo link (picto of pbject) { $morehtmlleft.='
'; if ($object->element == 'action') diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index fa8151563b1..6e5640d1e0a 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -53,14 +53,6 @@ function facture_prepare_head($object) $h++; } - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$object->id; - $head[$h][1] = $langs->trans('Preview'); - $head[$h][2] = 'preview'; - $h++; - } - //if ($fac->mode_reglement_code == 'PRE') if (! empty($conf->prelevement->enabled)) { diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 1458f37fdce..6bfb2541c11 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -60,14 +60,6 @@ function commande_prepare_head(Commande $object) $h++; } - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$object->id; - $head[$h][1] = $langs->trans("Preview"); - $head[$h][2] = 'preview'; - $h++; - } - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 13fbe06e7d4..66ef1146850 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -55,13 +55,6 @@ function propal_prepare_head($object) $head[$h][2] = 'shipping'; $h++; } - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?id='.$object->id; - $head[$h][1] = $langs->trans("Preview"); - $head[$h][2] = 'preview'; - $h++; - } if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {