corrections concernant export pdf

This commit is contained in:
Andre Cianfarani 2006-02-11 14:40:50 +00:00
parent e689c81b82
commit ecaa6eb84d
2 changed files with 27 additions and 6 deletions

View File

@ -231,8 +231,8 @@ class Commande
{
$this->projetid = 0;
}
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client) ';
$sql .= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.', '.$this->db->idate($this->date_commande).', '.$this->source.', \''.$this->note.'\', \''.$this->ref_client.'\')';
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client, model_pdf) ';
$sql .= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.', '.$this->db->idate($this->date_commande).', '.$this->source.', \''.$this->note.'\', \''.$this->ref_client.'\', \''.$this->modelpdf.'\')';
if ( $this->db->query($sql) )
{
@ -446,7 +446,7 @@ class Commande
function fetch($id)
{
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva';
$sql .= ', '.$this->db->pdate('c.date_commande').' as date_commande, c.fk_projet, c.remise_percent, c.source, c.facture, c.note, c.ref_client';
$sql .= ', '.$this->db->pdate('c.date_commande').' as date_commande, c.fk_projet, c.remise_percent, c.source, c.facture, c.note, c.ref_client, c.model_pdf';
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql .= ' WHERE c.rowid = '.$id;
@ -469,6 +469,7 @@ class Commande
$this->facturee = $obj->facture;
$this->note = $obj->note;
$this->projet_id = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->db->free();
if ($this->statut == 0)

View File

@ -86,6 +86,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
$commande->projetid = $_POST['projetid'];
$commande->remise_percent = $_POST['remise_percent'];
$commande->ref_client = $_POST['ref_client'];
$commande->modelpdf = $_POST['model'];
$commande->add_product($_POST['idprod1'],$_POST['qty1'],$_POST['remise_percent1']);
$commande->add_product($_POST['idprod2'],$_POST['qty2'],$_POST['remise_percent2']);
@ -222,13 +223,20 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
}
}
if ($_GET['action'] == 'builddoc' || $_POST['action'] == 'builddoc')
if ($_POST['action'] == 'builddoc')
{
/*
* Generation de la commande
* définit dans /includes/modules/commande/modules_commande.php
*/
commande_pdf_create($db, $_GET['id'],$_POST['model']);
}
if($_GET['action'] == 'builddoc')
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
commande_pdf_create($db, $_GET['id'],$commande->modelpdf);
}
@ -312,7 +320,16 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
print '<tr><td>'.$langs->trans('Source').'</td><td>';
$html->select_array('source_id',$new_commande->sources,2);
print '</td></tr>';
print '<tr><td>Modèle</td>';
print '<td>';
// pdf
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php');
$form=new Form($db);
$model=new ModelePDFCommandes();
$liste=$model->liste_modeles($db);
$form->select_array("model",$liste,$conf->global->COMMANDE_ADDON_PDF);
print "</td></tr>";
if ($propalid > 0)
{
$amount = ($obj->price);
@ -579,8 +596,10 @@ else
{
print nl2br($commande->note);
}
print '</td>';
print '</tr>';
// Société
print '<tr><td>'.$langs->trans('Customer').'</td>';
@ -939,7 +958,8 @@ else
print '<br>';
}
*/
$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed);
//$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/*
* Liste des factures
*/