Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 210 lines (172 sloc) 6.523 kb
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
1 <?php
2 /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
f8329da8 » eldy
2010-03-27 Remove pre.inc.php
3 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
1eeddb3e » eldy
2007-10-31 Uniformisation formulaires apercu
4 * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
20ea744d » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
5 * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
5c9ba8a5 » simnandez
2011-10-29 [task 189] Move Error* key from other.lang into errors.lang files
6 * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
f4606c22 » eldy
2011-08-03 Fix: Avoid errors into rpm packages
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
20 */
21
22 /**
20ea744d » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
23 * \file htdocs/comm/propal/apercu.php
24 * \ingroup propal
25 * \brief Page de l'onglet apercu d'une propal
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
26 */
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
27
f8329da8 » eldy
2010-03-27 Remove pre.inc.php
28 require("../../main.inc.php");
e4ea54f3 » hregis
2010-04-28 Fix: move class to class directory
29 require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php');
56d6cbe5 » hregis
2011-10-24 [task #216] Move lib in core directory
30 require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php");
31 require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
b749e6bd » Philippe Grand
2010-04-29 according to new tree directory
32 if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
59a18bbb » eldy
2006-06-03 Qual: Factorisation du code de gestion des onglets pour les propales
33
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
34 $langs->load('propal');
35 $langs->load("bills");
4f812cb4 » hregis
2005-09-11 Ajout traduction
36 $langs->load('compta');
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
37
99297fea » eldy
2008-02-24 Fix: Security check
38 // Security check
11a3b7f6 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
39 $socid=0;
1645ddbe » eldy
2012-02-27 Sec: Sanitize all input for ids.
40 $id = GETPOST('id','int');
11a3b7f6 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
41 $ref = GETPOST("ref");
646a6307 » eldy
2008-02-25 New: Super clean of permissions checks
42 if ($user->societe_id) $socid=$user->societe_id;
1cddc256 » hregis
2010-06-30 Fix: uniformize code, best way for optimizing code
43 $result = restrictedArea($user, 'propale', $id, 'propal');
99297fea » eldy
2008-02-24 Fix: Security check
44
45
46 /*
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
47 * View
48 */
59a18bbb » eldy
2006-06-03 Qual: Factorisation du code de gestion des onglets pour les propales
49
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
50 llxHeader();
51
f0c327c0 » hregis
2011-11-08 Fix: uniform code
52 $form = new Form($db);
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
53
54 /* *************************************************************************** */
55 /* */
56 /* Mode fiche */
57 /* */
58 /* *************************************************************************** */
59
11a3b7f6 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
60 if ($id > 0 || ! empty($ref))
59a18bbb » eldy
2006-06-03 Qual: Factorisation du code de gestion des onglets pour les propales
61 {
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
62 $object = new Propal($db);
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
63
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
64 if ($object->fetch($id,$ref) > 0)
59a18bbb » eldy
2006-06-03 Qual: Factorisation du code de gestion des onglets pour les propales
65 {
b75d19c2 » eldy
2011-09-11 Qual: Uniformize constructors
66 $soc = new Societe($db);
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
67 $soc->fetch($object->socid);
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
68
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
69 $head = propal_prepare_head($object);
3ef5f969 » eldy
2009-08-05 New: Add picto on tab titles
70 dol_fiche_head($head, 'preview', $langs->trans('Proposal'), 0, 'propal');
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
71
72
73 /*
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
74 * Propal
75 */
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
76 print '<table class="border" width="100%">';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
77
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
78 // Ref
79 print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="5">'.$object->ref.'</td></tr>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
80
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
81 // Ref client
82 print '<tr><td>';
83 print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
84 print $langs->trans('RefCustomer').'</td><td align="left">';
85 print '</td>';
86 print '</tr></table>';
87 print '</td><td colspan="5">';
88 print $object->ref_client;
89 print '</td>';
90 print '</tr>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
91
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
92 $rowspan=2;
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
93
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
94 // Tiers
95 print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$soc->getNomUrl(1).'</td>';
96 print '</tr>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
97
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
98 // Ligne info remises tiers
99 print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
100 if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
101 else print $langs->trans("CompanyHasNoRelativeDiscount");
102 $absolute_discount=$soc->getAvailableDiscounts();
103 print '. ';
839781df » eldy
2011-11-23 Qual: Removed a TODO by renaming all ->monnaie into ->currency
104 if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
105 else print $langs->trans("CompanyHasNoAbsoluteDiscount");
106 print '.';
107 print '</td></tr>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
108
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
109 // ligne
110 // partie Gauche
111 print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
f35b2887 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
112 print dol_print_date($object->date,'daytext');
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
113 print '</td>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
114
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
115 // partie Droite sur $rowspan lignes
116 print '<td colspan="2" rowspan="'.$rowspan.'" valign="top" width="50%">';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
117
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
118 /*
119 * Documents
120 */
11a3b7f6 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
121 $objectref = dol_sanitizeFileName($object->ref);
5d2da2c8 » hregis
2012-03-22 Fix: uniformize code
122 $dir_output = $conf->propal->dir_output . "/";
11a3b7f6 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
123 $filepath = $dir_output . $objectref . "/";
124 $file = $filepath . $objectref . ".pdf";
125 $filedetail = $filepath . $objectref . "-detail.pdf";
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
126 $relativepath = $objectref.'/'.$objectref.'.pdf';
127 $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
128
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
129 // Chemin vers png apercus
130 $fileimage = $file.".png"; // Si PDF d'1 page
90eac502 » hregis
2011-03-04 Fix: view multi page
131 $fileimagebis = $file."-0.png"; // Si PDF de plus d'1 page
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
132 $relativepathimage = $relativepath.'.png';
133
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
134 $var=true;
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
135
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
136 // Si fichier PDF existe
137 if (file_exists($file))
138 {
139 $encfile = urlencode($file);
140 print_titre($langs->trans("Documents"));
141 print '<table class="border" width="100%">';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
142
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
143 print "<tr $bc[$var]><td>".$langs->trans("Propal")." PDF</td>";
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
144
f35b2887 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
145 print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
146
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
147 print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>';
148 print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
149 print '</tr>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
150
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
151 print "</table>\n";
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
152
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
153 // Conversion du PDF en image png si fichier png non existant
154 if (! file_exists($fileimage) && ! file_exists($fileimagebis))
155 {
156 if (class_exists("Imagick"))
0a585f16 » eldy
2005-09-29 Fix: Pied de page propal azur et erreur apercu
157 {
a6e61492 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
158 $ret = dol_convert_file($file);
159 if ($ret < 0) $error++;
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
160 }
a6e61492 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
161 else
162 {
5c9ba8a5 » simnandez
2011-10-29 [task 189] Move Error* key from other.lang into errors.lang files
163 $langs->load("errors");
a6e61492 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
164 print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
165 }
166 }
a6e61492 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
167 }
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
168
a6e61492 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
169 print "</td>";
170 print '</tr>';
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
171
a6e61492 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
172 print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
173 print '<td align="right" colspan="2"><b>'.price($object->price).'</b></td>';
839781df » eldy
2011-11-23 Qual: Removed a TODO by renaming all ->monnaie into ->currency
174 print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
a6e61492 » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
175 print '</table>';
c5c7e3eb » hregis
2011-03-04 Fix: reencoding preview tabs, Imagick is a class today
176 }
177 else
178 {
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
179 // Propal non trouvee
1cddc256 » hregis
2010-06-30 Fix: uniformize code, best way for optimizing code
180 print $langs->trans("ErrorPropalNotFound",$_GET["id"]);
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
181 }
182 }
183
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
184 // Si fichier png PDF d'1 page trouve
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
185 if (file_exists($fileimage))
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
186 {
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
187 print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
188 }
189 // Si fichier png PDF de plus d'1 page trouve
0a585f16 » eldy
2005-09-29 Fix: Pied de page propal azur et erreur apercu
190 elseif (file_exists($fileimagebis))
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
191 {
106a9568 » eldy
2011-05-21 Fix: Some fix in preview feature.
192 $multiple = preg_replace('/\.png/','',$relativepath) . "-";
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
193
da785fad » hregis
2011-03-04 Fix: view multi page
194 for ($i = 0; $i < 20; $i++)
0a585f16 » eldy
2005-09-29 Fix: Pied de page propal azur et erreur apercu
195 {
90eac502 » hregis
2011-03-04 Fix: view multi page
196 $preview = $multiple.$i.'.png';
035073b9 » hregis
2006-06-09 Affichage de tous les aperçus
197
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
198 if (file_exists($dir_output.$preview))
035073b9 » hregis
2006-06-09 Affichage de tous les aperçus
199 {
ae3cfce7 » eldy
2010-02-21 New: Add patch from meos to resize images
200 print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>';
201 }
0a585f16 » eldy
2005-09-29 Fix: Pied de page propal azur et erreur apercu
202 }
728ecbf6 » hregis
2006-06-09 Affichage de tous les aperçus
203 }
0a585f16 » eldy
2005-09-29 Fix: Pied de page propal azur et erreur apercu
204
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
205 print '</div>';
206
207 $db->close();
208
726d9581 » hregis
2011-08-27 Fix: remove obsolete tags (in progress)
209 llxFooter();
2761efc4 » eldy
2005-08-13 New: Gestion des aperçus sur les propales (patch de Christophe)
210 ?>
Something went wrong with that request. Please try again.