Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
9de2bf58
Commit
9de2bf58
authored
19 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Ajout onglet aperçu sur la fiche commande client
parent
c0bb1f72
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/commande/apercu.php
+323
-0
323 additions, 0 deletions
htdocs/commande/apercu.php
htdocs/commande/fiche.php
+0
-1
0 additions, 1 deletion
htdocs/commande/fiche.php
with
323 additions
and
1 deletion
htdocs/commande/apercu.php
0 → 100644
+
323
−
0
View file @
9de2bf58
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 ric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/commande/apercu.php
\ingroup commande
\brief Page de l'onglet aperu d'une commande
\version $Revision$
*/
require
(
"./pre.inc.php"
);
$user
->
getrights
(
'commande'
);
$user
->
getrights
(
'expedition'
);
if
(
!
$user
->
rights
->
commande
->
lire
)
accessforbidden
();
$langs
->
load
(
'propal'
);
$langs
->
load
(
"bills"
);
$langs
->
load
(
'compta'
);
require_once
(
DOL_DOCUMENT_ROOT
.
'/commande/commande.class.php'
);
require_once
(
DOL_DOCUMENT_ROOT
.
'/propal.class.php'
);
if
(
$conf
->
projet
->
enabled
)
{
require_once
(
DOL_DOCUMENT_ROOT
.
"/project.class.php"
);
}
/*
* Scurit accs client
*/
if
(
$user
->
societe_id
>
0
)
{
$action
=
''
;
$socidp
=
$user
->
societe_id
;
}
llxHeader
();
$html
=
new
Form
(
$db
);
/* *************************************************************************** */
/* */
/* Mode fiche */
/* */
/* *************************************************************************** */
if
(
$_GET
[
"id"
]
>
0
)
{
$commande
=
new
Commande
(
$db
);
if
(
$commande
->
fetch
(
$_GET
[
"id"
],
$user
->
societe_id
)
>
0
)
{
$soc
=
new
Societe
(
$db
,
$commande
->
socidp
);
$soc
->
fetch
(
$commande
->
socidp
);
$h
=
0
;
if
(
$conf
->
commande
->
enabled
&&
$user
->
rights
->
commande
->
lire
)
{
$head
[
$h
][
0
]
=
DOL_URL_ROOT
.
'/commande/fiche.php?id='
.
$commande
->
id
;
$head
[
$h
][
1
]
=
$langs
->
trans
(
'OrderCard'
);
$h
++
;
}
if
(
$conf
->
expedition
->
enabled
&&
$user
->
rights
->
expedition
->
lire
)
{
$head
[
$h
][
0
]
=
DOL_URL_ROOT
.
'/expedition/commande.php?id='
.
$commande
->
id
;
$head
[
$h
][
1
]
=
$langs
->
trans
(
'SendingCard'
);
$h
++
;
}
if
(
$conf
->
compta
->
enabled
)
{
$head
[
$h
][
0
]
=
DOL_URL_ROOT
.
'/compta/commande/fiche.php?id='
.
$commande
->
id
;
$head
[
$h
][
1
]
=
$langs
->
trans
(
'ComptaCard'
);
$h
++
;
}
if
(
$conf
->
use_preview_tabs
)
{
$head
[
$h
][
0
]
=
DOL_URL_ROOT
.
'/commande/apercu.php?id='
.
$commande
->
id
;
$head
[
$h
][
1
]
=
$langs
->
trans
(
"Preview"
);
$hselected
=
$h
;
$h
++
;
}
$head
[
$h
][
0
]
=
DOL_URL_ROOT
.
'/commande/info.php?id='
.
$commande
->
id
;
$head
[
$h
][
1
]
=
$langs
->
trans
(
'Info'
);
$h
++
;
dolibarr_fiche_head
(
$head
,
$hselected
,
$langs
->
trans
(
'Order'
)
.
': '
.
$commande
->
ref
);
/*
* Commande
*/
$sql
=
'SELECT s.nom, s.idp, p.price, p.fk_projet, p.remise, p.tva, p.total, p.ref, p.fk_statut, '
.
$db
->
pdate
(
'p.datep'
)
.
' as dp, p.note,'
;
$sql
.
=
' x.firstname, x.name, x.fax, x.phone, x.email, p.fk_user_author, p.fk_user_valid, p.fk_user_cloture, p.datec, p.date_valid, p.date_cloture'
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'societe as s, '
.
MAIN_DB_PREFIX
.
'propal as p, '
.
MAIN_DB_PREFIX
.
'socpeople as x'
;
$sql
.
=
' WHERE p.fk_soc = s.idp AND p.fk_soc_contact = x.idp AND p.rowid = '
.
$propal
->
id
;
if
(
$socidp
)
$sql
.
=
' AND s.idp = '
.
$socidp
;
$result
=
$db
->
query
(
$sql
);
if
(
$result
)
{
if
(
$db
->
num_rows
(
$result
))
{
$obj
=
$db
->
fetch_object
(
$result
);
$societe
=
new
Societe
(
$db
);
$societe
->
fetch
(
$obj
->
idp
);
print
'<table class="border" width="100%">'
;
$rowspan
=
3
;
// ligne 1
// partie Gauche
print
'<tr><td>'
.
$langs
->
trans
(
'Company'
)
.
'</td><td colspan="3">'
;
if
(
$societe
->
client
==
1
)
{
$url
=
DOL_URL_ROOT
.
'/comm/fiche.php?socid='
.
$societe
->
id
;
}
else
{
$url
=
DOL_URL_ROOT
.
'/comm/prospect/fiche.php?socid='
.
$societe
->
id
;
}
print
'<a href="'
.
$url
.
'">'
.
$societe
->
nom
.
'</a></td>'
;
// partie Droite
print
'<td align="left">Conditions de rglement</td>'
;
print
'<td>'
.
' '
.
'</td>'
;
print
'</tr>'
;
// ligne 2
// partie Gauche
print
'<tr><td>'
.
$langs
->
trans
(
'Date'
)
.
'</td><td colspan="3">'
;
print
dolibarr_print_date
(
$propal
->
date
,
'%a %e %B %Y'
);
print
'</td>'
;
// partie Droite
print
'<td>'
.
$langs
->
trans
(
'DateEndPropal'
)
.
'</td><td>'
;
if
(
$propal
->
fin_validite
)
{
print
dolibarr_print_date
(
$propal
->
fin_validite
,
'%a %d %B %Y'
);
}
else
{
print
$langs
->
trans
(
"Unknown"
);
}
print
'</td>'
;
print
'</tr>'
;
// Destinataire
$langs
->
load
(
'mails'
);
// ligne 3
print
'<tr>'
;
// partie Gauche
print
'<td>'
.
$langs
->
trans
(
'MailTo'
)
.
'</td>'
;
$dests
=
$societe
->
contact_array
(
$societe
->
id
);
$numdest
=
count
(
$dests
);
print
'<td colspan="3">'
;
if
(
$numdest
==
0
)
{
print
'<font class="error">Cette societe n\'a pas de contact, veuillez en crer un avant de faire votre proposition commerciale</font><br>'
;
print
'<a href="'
.
DOL_URL_ROOT
.
'/contact/fiche.php?socid='
.
$societe
->
id
.
'&action=create&backtoreferer=1">'
.
$langs
->
trans
(
'AddContact'
)
.
'</a>'
;
}
else
{
if
(
!
empty
(
$propal
->
contactid
))
{
require_once
(
DOL_DOCUMENT_ROOT
.
'/contact.class.php'
);
$contact
=
new
Contact
(
$db
);
$contact
->
fetch
(
$propal
->
contactid
);
print
'<a href="'
.
DOL_URL_ROOT
.
'/contact/fiche.php?id='
.
$propal
->
contactid
.
'" title="'
.
$langs
->
trans
(
'ShowContact'
)
.
'">'
;
print
$contact
->
firstname
.
' '
.
$contact
->
name
;
print
'</a>'
;
}
else
{
print
' '
;
}
}
print
'</td>'
;
// partie Droite sur $rowspan lignes
print
'<td colspan="2" rowspan="'
.
$rowspan
.
'" valign="top" width="50%">'
;
/*
* Documents
*/
$propalref
=
sanitize_string
(
$propal
->
ref
);
$file
=
$conf
->
propal
->
dir_output
.
"/"
.
$propalref
.
"/"
.
$propalref
.
".pdf"
;
$filedetail
=
$conf
->
propal
->
dir_output
.
"/"
.
$propalref
.
"/"
.
$propalref
.
"-detail.pdf"
;
$relativepath
=
"${propalref}/${propalref}.pdf"
;
$relativepathdetail
=
"${propalref}/${propalref}-detail.pdf"
;
// Chemin vers png aperus
$relativepathimage
=
"${propalref}/${propalref}.pdf.png"
;
$relativepathimagebis
=
"${propalref}/${propalref}.pdf.png.0"
;
$fileimage
=
$file
.
".png"
;
// Si PDF d'1 page
$fileimagebis
=
$file
.
".png.0"
;
// Si PDF de plus d'1 page
$var
=
true
;
// Si fichier PDF existe
if
(
file_exists
(
$file
))
{
$encfile
=
urlencode
(
$file
);
print_titre
(
$langs
->
trans
(
"Documents"
));
print
'<table class="border" width="100%">'
;
print
"<tr
$bc[$var]
><td>"
.
$langs
->
trans
(
"Propal"
)
.
" PDF</td>"
;
print
'<td><a href="'
.
DOL_URL_ROOT
.
'/document.php?modulepart=propal&file='
.
urlencode
(
$relativepath
)
.
'">'
.
$propal
->
ref
.
'.pdf</a></td>'
;
print
'<td align="right">'
.
filesize
(
$file
)
.
' bytes</td>'
;
print
'<td align="right">'
.
strftime
(
"%d %b %Y %H:%M:%S"
,
filemtime
(
$file
))
.
'</td>'
;
print
'</tr>'
;
// Si fichier detail PDF existe
if
(
file_exists
(
$filedetail
))
{
// propal dtaille supplmentaire
print
"<tr
$bc[$var]
><td>Propal dtaille</td>"
;
print
'<td><a href="'
.
DOL_URL_ROOT
.
'/document.php?modulepart=propal&file='
.
urlencode
(
$relativepathdetail
)
.
'">'
.
$propal
->
ref
.
'-detail.pdf</a></td>'
;
print
'<td align="right">'
.
filesize
(
$filedetail
)
.
' bytes</td>'
;
print
'<td align="right">'
.
strftime
(
"%d %b %Y %H:%M:%S"
,
filemtime
(
$filedetail
))
.
'</td>'
;
print
'</tr>'
;
}
print
"</table>
\n
"
;
// Conversion du PDF en image png si fichier png non existant
if
(
!
file_exists
(
$fileimage
)
&&
!
file_exists
(
$fileimagebis
))
{
if
(
function_exists
(
"imagick_readimage"
))
{
$handle
=
imagick_readimage
(
$file
)
;
if
(
imagick_iserror
(
$handle
)
)
{
$reason
=
imagick_failedreason
(
$handle
)
;
$description
=
imagick_faileddescription
(
$handle
)
;
print
"handle failed!<BR>
\n
Reason:
$reason
<BR>
\n
Description:
$description
<BR>
\n
"
;
}
imagick_convert
(
$handle
,
"PNG"
)
;
if
(
imagick_iserror
(
$handle
)
)
{
$reason
=
imagick_failedreason
(
$handle
)
;
$description
=
imagick_faileddescription
(
$handle
)
;
print
"handle failed!<BR>
\n
Reason:
$reason
<BR>
\n
Description:
$description
<BR>
\n
"
;
}
imagick_writeimage
(
$handle
,
$file
.
".png"
);
}
else
{
$langs
->
load
(
"other"
);
print
'<font class="error">'
.
$langs
->
trans
(
"ErrorNoImagickReadimage"
)
.
'</font>'
;
}
}
}
print
"</td></tr>"
;
// ligne 4
// partie Gauche
print
'<tr><td height="10" nowrap>'
.
$langs
->
trans
(
'GlobalDiscount'
)
.
'</td>'
;
print
'<td colspan="3">'
.
$propal
->
remise_percent
.
'%</td>'
;
print
'</tr>'
;
// ligne 5
// partie Gauche
print
'<tr><td height="10">'
.
$langs
->
trans
(
'AmountHT'
)
.
'</td>'
;
print
'<td align="right" colspan="2"><b>'
.
price
(
$propal
->
price
)
.
'</b></td>'
;
print
'<td>'
.
$langs
->
trans
(
"Currency"
.
$conf
->
monnaie
)
.
'</td></tr>'
;
print
'</table>'
;
}
}
else
{
dolibarr_print_error
(
$db
);
}
}
else
{
// Propal non trouve
print
$langs
->
trans
(
"ErrorPropalNotFound"
,
$_GET
[
"propalid"
]);
}
}
// Si fichier png PDF d'1 page trouv
if
(
file_exists
(
$fileimage
))
{
print
'<img src="'
.
DOL_URL_ROOT
.
'/viewimage.php?modulepart=apercupropal&file='
.
urlencode
(
$relativepathimage
)
.
'">'
;
}
// Si fichier png PDF de plus d'1 page trouv
elseif
(
file_exists
(
$fileimagebis
))
{
print
'<img src="'
.
DOL_URL_ROOT
.
'/viewimage.php?modulepart=apercupropal&file='
.
urlencode
(
$relativepathimagebis
)
.
'">'
;
}
print
'</div>'
;
// Juste pour viter bug IE qui rorganise mal div prcdents si celui-ci absent
print
'<div class="tabsAction">'
;
print
'</div>'
;
$db
->
close
();
llxFooter
(
'$Date$ - $Revision$'
);
?>
This diff is collapsed.
Click to expand it.
htdocs/commande/fiche.php
+
0
−
1
View file @
9de2bf58
...
...
@@ -477,7 +477,6 @@ else
{
$head
[
$h
][
0
]
=
DOL_URL_ROOT
.
'/commande/apercu.php?id='
.
$commande
->
id
;
$head
[
$h
][
1
]
=
$langs
->
trans
(
"Preview"
);
$hselected
=
$h
;
$h
++
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment