*** empty log message ***

This commit is contained in:
Rodolphe Quiedeville 2002-12-12 17:04:27 +00:00
parent d9da53861e
commit 5b6a693c5b
2 changed files with 112 additions and 40 deletions

View File

@ -1,8 +1,5 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* 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
@ -18,10 +15,12 @@
* 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$
*
*/
require("./pre.inc.php3");
require("./propal.class.php3");
$db = new Db();
@ -29,10 +28,12 @@ $db = new Db();
$sql = "SELECT s.nom, s.idp, s.prefix_comm FROM societe as s WHERE s.idp = $socidp;";
$result = $db->query($sql);
if ($result) {
if ( $db->num_rows() ) {
$objsoc = $db->fetch_object(0);
}
if ($result)
{
if ( $db->num_rows() )
{
$objsoc = $db->fetch_object(0);
}
$db->free();
}
@ -63,27 +64,28 @@ if ($action == 'add') {
* Generation
*
*/
if ($id) {
// print "<hr><b>Génération du PDF</b><p>";
if ($id)
{
//$DBI = "dbi:mysql:dbname=lolixdev:host=espy:user=rodo";
//$gljroot = "/home/www/dolibarr/dolibarr/htdocs";
$gljroot = "/home/www/dolibarr/dolibarr/htdocs";
$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name.":host=localhost\" ";
$command .= " ; ./propal-tex.pl --propal=".$id ." --pdf --ps --output=".$conf->propal->outputdir;
$command .= " --templates=".$conf->propal->templatesdir;
$output = system($command);
//print "<p>command : $command<br>";
//print $output;
$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name.":host=localhost\" ";
$command .= " ; ./propal-tex.pl --propal=".$id ." --pdf --ps --output=".$conf->propal->outputdir;
$command .= " --templates=".$conf->propal->templatesdir;
$output = system($command);
//print "<p>command : $command<br>";
//print $output;
// Header("Location: propal.php3?propalid=$id");
} else {
print $db->error();
}
/*
* Renvoie directement sur la fiche
*/
//Header("Location: propal.php3?propalid=$id");
}
else
{
print $db->error();
}
}
llxHeader();
@ -111,7 +113,7 @@ if ($action == 'create') {
}
}
print "<form action=\"$PHP_SELF?socidp=$socidp\" method=\"post\">";
print "<form action=\"propal.php3?socidp=$socidp\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print '<table border="1" cellspacing="0" cellpadding="3" width="100%"><tr><td width="50%" valign="top">';
@ -307,7 +309,7 @@ if ( $db->query($sql) ) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"index.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
print "<TD><a href=\"fiche.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
print "<TD><a href=\"propal.php3?propalid=$objp->propalid\">$objp->ref</a></TD>\n";
print "<TD>$objp->lst</TD>\n";

View File

@ -36,8 +36,65 @@ llxHeader();
$db = new Db();
/******************************************************************************/
/* Actions */
/******************************************************************************/
if ($action == 'setstatut') {
if ($action == 'add')
{
$propal = new Propal($db, $socidp);
$propal->remise = $remise;
$propal->datep = $db->idate(mktime(12, 1 , 1, $pmonth, $pday, $pyear));
$propal->contactid = $contactidp;
$propal->projetidp = $projetidp;
$propal->author = $user->id;
$propal->note = $note;
$propal->ref = $ref;
$propal->add_product($idprod1,$qty1);
$propal->add_product($idprod2,$qty2);
$propal->add_product($idprod3,$qty3);
$propal->add_product($idprod4,$qty4);
$id = $propal->create();
/*
*
* Generation
*
*/
if ($id)
{
//$gljroot = "/home/www/dolibarr/dolibarr/htdocs";
$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name.":host=localhost\" ";
$command .= " ; ./propal-tex.pl --propal=".$id ." --pdf --ps --output=".$conf->propal->outputdir;
$command .= " --templates=".$conf->propal->templatesdir;
$output = system($command);
//print "<p>command : $command<br>";
//print $output;
/*
* Renvoie directement sur la fiche
*/
//Header("Location: propal.php3?propalid=$id");
$propalid = $id;
}
else
{
print $db->error();
}
}
if ($action == 'setstatut')
{
/*
* Cloture de la propale
*/
@ -45,24 +102,37 @@ if ($action == 'setstatut') {
$propal->id = $propalid;
$propal->cloture($user->id, $statut, $note);
} elseif ( $action == 'delete' ) {
}
elseif ( $action == 'delete' )
{
$sql = "DELETE FROM llx_propal WHERE rowid = $propalid;";
if ( $db->query($sql) ) {
if ( $db->query($sql) )
{
$sql = "DELETE FROM llx_propaldet WHERE fk_propal = $propalid ;";
if ( $db->query($sql) ) {
print "<b><font color=\"red\">Propal supprimée</font></b>";
} else {
$sql = "DELETE FROM llx_propaldet WHERE fk_propal = $propalid ;";
if ( $db->query($sql) )
{
print "<b><font color=\"red\">Propal supprimée</font></b>";
}
else
{
print $db->error();
print "<p>$sql";
}
}
else
{
print $db->error();
print "<p>$sql";
}
} else {
print $db->error();
print "<p>$sql";
}
}
$propalid = 0;
$brouillon = 1;
}
/******************************************************************************/
/* Fin des Actions */
/******************************************************************************/
/*
*
* Mode fiche