include payment term within supplier order
This commit is contained in:
parent
a670d449be
commit
56feb1c32f
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* 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
|
||||
@ -67,6 +68,8 @@ class CommandeFournisseur extends Commande
|
||||
var $note_public;
|
||||
var $model_pdf;
|
||||
var $fk_project;
|
||||
var $cond_reglement_id;
|
||||
var $cond_reglement_code;
|
||||
|
||||
|
||||
/** \brief Constructeur
|
||||
@ -103,10 +106,12 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
|
||||
$sql.= " c.localtax1, c.localtax2, ";
|
||||
$sql.= " c.date_commande as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
|
||||
$sql.= " c.date_commande as date_commande, c.fk_cond_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
|
||||
$sql.= " c.note, c.note_public, c.model_pdf,";
|
||||
$sql.= " cm.libelle as methode_commande";
|
||||
$sql.= " cm.libelle as methode_commande,";
|
||||
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_methode_commande";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if ($ref) $sql.= " AND c.ref='".$ref."'";
|
||||
@ -139,6 +144,9 @@ class CommandeFournisseur extends Commande
|
||||
$this->source = $obj->source;
|
||||
$this->facturee = $obj->facture;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->cond_reglement_id = $obj->fk_cond_reglement;
|
||||
$this->cond_reglement_code = $obj->cond_reglement_code;
|
||||
$this->cond_reglement = $obj->cond_reglement_libelle;;
|
||||
$this->note = $obj->note;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
@ -1148,6 +1156,39 @@ class CommandeFournisseur extends Commande
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change les conditions de reglement de la commande
|
||||
* \param cond_reglement_id Id de la nouvelle condition de reglement
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function cond_reglement($cond_reglement_id)
|
||||
{
|
||||
dol_syslog('CommandeFournisseur::cond_reglement('.$cond_reglement_id.')');
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
|
||||
$sql .= ' SET fk_cond_reglement = '.$cond_reglement_id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->cond_reglement_id = $cond_reglement_id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('CommandeFournisseur::cond_reglement Erreur '.$sql.' - '.$this->db->error(), LOG_ERR);
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('CommandeFournisseur::cond_reglement, etat commande incompatible', LOG_ERR);
|
||||
$this->error='Etat commande incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a delivery in database for this supplier order
|
||||
* @param user User that input data
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@ ALTER TABLE llx_adherent MODIFY login varchar(50);
|
||||
|
||||
ALTER TABLE llx_c_actioncomm ADD COLUMN position integer NOT NULL DEFAULT 0;
|
||||
ALTER TABLE llx_propal ADD COLUMN fk_demand_reason integer NULL DEFAULT 0;
|
||||
ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_cond_reglement integer NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur MODIFY model_pdf varchar(255);
|
||||
ALTER TABLE llx_commande MODIFY model_pdf varchar(255);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user