mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-05 15:45:25 +01:00
NEW : Template supplier invoices
This commit is contained in:
@@ -261,6 +261,11 @@ class Commande extends CommonOrder
|
||||
//! key of pos source ('0', '1', ...)
|
||||
public $pos_source;
|
||||
|
||||
/**
|
||||
* @var array Array with line of all shipments
|
||||
*/
|
||||
public $expeditions;
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
@@ -386,9 +391,6 @@ class Commande extends CommonOrder
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->remise = 0;
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -493,7 +495,8 @@ class Commande extends CommonOrder
|
||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||
$sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
|
||||
$sql .= " date_valid='".$this->db->idate($now)."',";
|
||||
$sql .= " fk_user_valid = ".((int) $user->id);
|
||||
$sql .= " fk_user_valid = ".((int) $user->id).",";
|
||||
$sql .= " fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::valid", LOG_DEBUG);
|
||||
@@ -623,7 +626,8 @@ class Commande extends CommonOrder
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql .= " SET fk_statut = ".self::STATUS_DRAFT;
|
||||
$sql .= " SET fk_statut = ".self::STATUS_DRAFT.",";
|
||||
$sql .= " fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
@@ -697,7 +701,8 @@ class Commande extends CommonOrder
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||
$sql .= ' SET fk_statut='.self::STATUS_VALIDATED.', facture=0';
|
||||
$sql .= ' SET fk_statut='.self::STATUS_VALIDATED.', facture=0,';
|
||||
$sql .= " fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG);
|
||||
@@ -758,7 +763,8 @@ class Commande extends CommonOrder
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET fk_statut = '.self::STATUS_CLOSED.',';
|
||||
$sql .= ' fk_user_cloture = '.((int) $user->id).',';
|
||||
$sql .= " date_cloture = '".$this->db->idate($now)."'";
|
||||
$sql .= " date_cloture = '".$this->db->idate($now)."',";
|
||||
$sql .= " fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > '.self::STATUS_DRAFT;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
@@ -806,7 +812,8 @@ class Commande extends CommonOrder
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql .= " SET fk_statut = ".self::STATUS_CANCELED;
|
||||
$sql .= " SET fk_statut = ".self::STATUS_CANCELED.",";
|
||||
$sql .= " fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
$sql .= " AND fk_statut = ".self::STATUS_VALIDATED;
|
||||
|
||||
@@ -1782,7 +1789,7 @@ class Commande extends CommonOrder
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql .= ', c.fk_account';
|
||||
$sql .= ', c.date_commande, c.date_valid, c.tms';
|
||||
@@ -1847,6 +1854,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->user_modification = $obj->fk_user_modif;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_localtax1 = $obj->total_localtax1;
|
||||
@@ -2007,9 +2015,9 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Load array lines
|
||||
*
|
||||
* @param int $only_product Return only physical products, not services
|
||||
* @param int $only_product Return only physical products, not services
|
||||
* @param int $loadalsotranslation Return translation for products
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||
{
|
||||
@@ -2204,9 +2212,10 @@ class Commande extends CommonOrder
|
||||
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
|
||||
*
|
||||
* @param int $filtre_statut Filter on shipment status
|
||||
* @param int $fk_product Add a filter on a product
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
*/
|
||||
public function loadExpeditions($filtre_statut = -1)
|
||||
public function loadExpeditions($filtre_statut = -1, $fk_product = 0)
|
||||
{
|
||||
$this->expeditions = array();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user