corrections concernant export pdf
This commit is contained in:
parent
e689c81b82
commit
ecaa6eb84d
@ -231,8 +231,8 @@ class Commande
|
|||||||
{
|
{
|
||||||
$this->projetid = 0;
|
$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 = '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.'\')';
|
$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) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
@ -446,7 +446,7 @@ class Commande
|
|||||||
function fetch($id)
|
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 = '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 .= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
||||||
$sql .= ' WHERE c.rowid = '.$id;
|
$sql .= ' WHERE c.rowid = '.$id;
|
||||||
|
|
||||||
@ -469,6 +469,7 @@ class Commande
|
|||||||
$this->facturee = $obj->facture;
|
$this->facturee = $obj->facture;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->projet_id = $obj->fk_projet;
|
$this->projet_id = $obj->fk_projet;
|
||||||
|
$this->modelpdf = $obj->model_pdf;
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
|
|||||||
@ -86,6 +86,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
|||||||
$commande->projetid = $_POST['projetid'];
|
$commande->projetid = $_POST['projetid'];
|
||||||
$commande->remise_percent = $_POST['remise_percent'];
|
$commande->remise_percent = $_POST['remise_percent'];
|
||||||
$commande->ref_client = $_POST['ref_client'];
|
$commande->ref_client = $_POST['ref_client'];
|
||||||
|
$commande->modelpdf = $_POST['model'];
|
||||||
|
|
||||||
$commande->add_product($_POST['idprod1'],$_POST['qty1'],$_POST['remise_percent1']);
|
$commande->add_product($_POST['idprod1'],$_POST['qty1'],$_POST['remise_percent1']);
|
||||||
$commande->add_product($_POST['idprod2'],$_POST['qty2'],$_POST['remise_percent2']);
|
$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
|
* Generation de la commande
|
||||||
* définit dans /includes/modules/commande/modules_commande.php
|
* définit dans /includes/modules/commande/modules_commande.php
|
||||||
*/
|
*/
|
||||||
commande_pdf_create($db, $_GET['id'],$_POST['model']);
|
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,6 +320,15 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
|||||||
print '<tr><td>'.$langs->trans('Source').'</td><td>';
|
print '<tr><td>'.$langs->trans('Source').'</td><td>';
|
||||||
$html->select_array('source_id',$new_commande->sources,2);
|
$html->select_array('source_id',$new_commande->sources,2);
|
||||||
print '</td></tr>';
|
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)
|
if ($propalid > 0)
|
||||||
{
|
{
|
||||||
@ -579,9 +596,11 @@ else
|
|||||||
{
|
{
|
||||||
print nl2br($commande->note);
|
print nl2br($commande->note);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
// Société
|
// Société
|
||||||
print '<tr><td>'.$langs->trans('Customer').'</td>';
|
print '<tr><td>'.$langs->trans('Customer').'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
@ -939,7 +958,8 @@ else
|
|||||||
print '<br>';
|
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
|
* Liste des factures
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user