Save pos station into invoice

This commit is contained in:
Laurent Destailleur 2018-10-08 22:28:30 +02:00
parent 44d0ed7a0c
commit 41f2289ffa
5 changed files with 9 additions and 2 deletions

View File

@ -216,6 +216,7 @@ switch ($action)
$invoice->cond_reglement_id=$cond_reglement_id;
$invoice->mode_reglement_id=$mode_reglement_id;
$invoice->module_source = 'cashdesk';
$invoice->pos_source = '0';
//print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit;
// Si paiement differe ...

View File

@ -128,6 +128,8 @@ class Facture extends CommonInvoice
public $paye;
//! key of module source when invoice generated from a dedicated module ('cashdesk', 'takepos', ...)
public $module_source;
//! key of pos source ('0', '1', ...)
public $pos_source;
//! id of template invoice when generated from a template invoice
public $fk_fac_rec_source;
//! id of source invoice if replacement invoice or credit note
@ -447,7 +449,7 @@ class Facture extends CommonInvoice
$sql.= ", note_public";
$sql.= ", ref_client, ref_int";
$sql.= ", fk_account";
$sql.= ", module_source, fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet";
$sql.= ", module_source, pos_source, fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet";
$sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf";
$sql.= ", situation_cycle_ref, situation_counter, situation_final";
$sql.= ", fk_incoterms, location_incoterms";
@ -472,6 +474,7 @@ class Facture extends CommonInvoice
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
$sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
$sql.= ", ".($this->pos_source ? "'".$this->db->escape($this->pos_source)."'" : "null");
$sql.= ", ".($this->fk_fac_rec_source?"'".$this->db->escape($this->fk_fac_rec_source)."'":"null");
$sql.= ", ".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null");
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");

View File

@ -35,6 +35,7 @@ ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32) NOT NULL
ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version);
ALTER TABLE llx_facture ADD COLUMN module_source varchar(32);
ALTER TABLE llx_facture ADD COLUMN pos_source varchar(32);
create table llx_facture_rec_extrafields
(

View File

@ -64,6 +64,7 @@ create table llx_facture
fk_user_valid integer, -- user validating
module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...)
pos_source varchar(32), -- name of POS station when invoice is generated by a POS module
fk_fac_rec_source integer, -- facture rec source
fk_facture_source integer, -- facture origin if credit notes or replacement invoice
fk_projet integer DEFAULT NULL, -- project invoice is linked to

View File

@ -83,9 +83,10 @@ if (($action=="addline" || $action=="freezone") and $placeid==0)
$invoice->date=dol_now();
$invoice->ref="(PROV-POS)";
$invoice->module_source = 'takepos';
$invoice->pos_source = (string) $place;
$placeid=$invoice->create($user);
$sql="UPDATE ".MAIN_DB_PREFIX."facture set facnumber='(PROV-POS-".$place.")' where rowid=".$placeid;
$sql="UPDATE ".MAIN_DB_PREFIX."facture set facnumber='(PROV-POS-".$placeid.")' where rowid=".$placeid;
$db->query($sql);
}
}