Fixed bug #846: Create a supplier invoice (without project)

This commit is contained in:
Marcos García 2013-04-26 06:34:41 +02:00
parent 271dcf578f
commit 6ac6f6e911
2 changed files with 31 additions and 29 deletions

View File

@ -155,7 +155,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= ", ".$this->socid; $sql.= ", ".$this->socid;
$sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", '".$this->db->idate($this->date)."'"; $sql.= ", '".$this->db->idate($this->date)."'";
$sql.= ", ".$this->fk_project; $sql.= ", ".(isset($this->fk_project)?$this->fk_project:"null");
$sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_private)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'";
$sql.= ", ".$user->id.","; $sql.= ", ".$user->id.",";

View File

@ -270,16 +270,18 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
{ {
$db->begin(); $db->begin();
$tmpproject = GETPOST('projectid', 'int');
// Creation facture // Creation facture
$object->ref = $_POST['ref']; $object->ref = $_POST['ref'];
$object->ref_supplier = $_POST['ref_supplier']; $object->ref_supplier = $_POST['ref_supplier'];
$object->fk_project = GETPOST('projectid');
$object->socid = $_POST['socid']; $object->socid = $_POST['socid'];
$object->libelle = $_POST['libelle']; $object->libelle = $_POST['libelle'];
$object->date = $datefacture; $object->date = $datefacture;
$object->date_echeance = $datedue; $object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public'); $object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private'); $object->note_private = GETPOST('note_private');
$object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
// If creation from another object of another module // If creation from another object of another module
if ($_POST['origin'] && $_POST['originid']) if ($_POST['origin'] && $_POST['originid'])