doxygen
This commit is contained in:
parent
aad939a270
commit
7936cd8dea
@ -23,7 +23,7 @@
|
||||
* \file htdocs/comm/action/class/actioncomm.class.php
|
||||
* \ingroup commercial
|
||||
* \brief File of class to manage agenda events (actions)
|
||||
* \version $Id: actioncomm.class.php,v 1.41 2011/06/30 07:52:43 eldy Exp $
|
||||
* \version $Id: actioncomm.class.php,v 1.42 2011/07/04 09:36:29 eldy Exp $
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php');
|
||||
@ -391,8 +391,10 @@ class ActionComm extends CommonObject
|
||||
|
||||
/**
|
||||
* Load all objects with filters
|
||||
* @param socid Filter by thirdparty
|
||||
* @param filter Other filter
|
||||
* @param socid Filter by thirdparty
|
||||
* @param fk_element Id of element action is linked to
|
||||
* @param elementtype Type of element action is linked to
|
||||
* @param filter Other filter
|
||||
*/
|
||||
function getActions($socid=0, $fk_element=0, $elementtype='', $filter='')
|
||||
{
|
||||
@ -603,7 +605,7 @@ class ActionComm extends CommonObject
|
||||
* Utilise $this->id, $this->code et $this->label
|
||||
* @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param maxlength Nombre de caracteres max dans libelle
|
||||
* @param class Force style class on a link
|
||||
* @param classname Force style class on a link
|
||||
* @param option ''=Link to action,'birthday'=Link to contact
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
* \file htdocs/commande/class/commande.class.php
|
||||
* \ingroup commande
|
||||
* \brief Fichier des classes de commandes
|
||||
* \version $Id: commande.class.php,v 1.116 2011/06/30 13:27:20 hregis Exp $
|
||||
* \version $Id: commande.class.php,v 1.117 2011/07/04 09:36:29 eldy Exp $
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
@ -177,7 +177,7 @@ class Commande extends CommonObject
|
||||
function valid($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -239,7 +239,7 @@ class Commande extends CommonObject
|
||||
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
$langs->load("agenda");
|
||||
$langs->load("agenda");
|
||||
|
||||
// Loop on each line
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
@ -347,7 +347,7 @@ class Commande extends CommonObject
|
||||
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
$langs->load("agenda");
|
||||
$langs->load("agenda");
|
||||
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ class Commande extends CommonObject
|
||||
|
||||
if ($this->statut != 3)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
@ -451,13 +451,13 @@ class Commande extends CommonObject
|
||||
function cloture($user)
|
||||
{
|
||||
global $conf;
|
||||
$error=0;
|
||||
$error=0;
|
||||
|
||||
if ($user->rights->commande->valider)
|
||||
{
|
||||
$this->db->begin();
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
$now=dol_now();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||
$sql.= ' SET fk_statut = 3,';
|
||||
@ -476,21 +476,21 @@ class Commande extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
|
||||
$this->db->rollback();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -523,7 +523,7 @@ class Commande extends CommonObject
|
||||
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
$langs->load("agenda");
|
||||
$langs->load("agenda");
|
||||
|
||||
if ($this->lines[$i]->fk_product > 0)
|
||||
{
|
||||
@ -570,9 +570,10 @@ class Commande extends CommonObject
|
||||
|
||||
/**
|
||||
* Create order
|
||||
* @param user Objet user that make creation
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* remarks this->ref can be set or empty. If empty, we will use "(PROV)"
|
||||
* Note that this->ref can be set or empty. If empty, we will use "(PROV)"
|
||||
* @param user Objet user that make creation
|
||||
* @param notrigger Disable all triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
@ -694,7 +695,7 @@ class Commande extends CommonObject
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->ref="(PROV".$this->id.")";
|
||||
$this->ref="(PROV".$this->id.")";
|
||||
|
||||
// Add linked object
|
||||
if ($this->origin && $this->origin_id)
|
||||
@ -728,7 +729,7 @@ class Commande extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
@ -825,23 +826,23 @@ class Commande extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
// Hook of thirdparty module
|
||||
if (! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($objFrom,$result,$object->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($objFrom,$result,$object->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
@ -865,103 +866,103 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load an object from a proposal and create a new order into database
|
||||
* @param object Object source
|
||||
* @param invertdetail Reverse sign of amounts for lines
|
||||
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
||||
*/
|
||||
function createFromProposal($object,$invertdetail=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
/**
|
||||
* Load an object from a proposal and create a new order into database
|
||||
* @param object Object source
|
||||
* @param invertdetail Reverse sign of amounts for lines
|
||||
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
||||
*/
|
||||
function createFromProposal($object,$invertdetail=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$error=0;
|
||||
$error=0;
|
||||
|
||||
// Signed proposal
|
||||
if ($object->statut == 2)
|
||||
{
|
||||
$this->date_commande = dol_now();
|
||||
$this->source = 0;
|
||||
// Signed proposal
|
||||
if ($object->statut == 2)
|
||||
{
|
||||
$this->date_commande = dol_now();
|
||||
$this->source = 0;
|
||||
|
||||
for ($i = 0 ; $i < sizeof($object->lines) ; $i++)
|
||||
{
|
||||
$line = new OrderLine($this->db);
|
||||
for ($i = 0 ; $i < sizeof($object->lines) ; $i++)
|
||||
{
|
||||
$line = new OrderLine($this->db);
|
||||
|
||||
$line->libelle = $object->lines[$i]->libelle;
|
||||
$line->desc = $object->lines[$i]->desc;
|
||||
$line->price = $object->lines[$i]->price;
|
||||
$line->subprice = $object->lines[$i]->subprice;
|
||||
$line->tva_tx = $object->lines[$i]->tva_tx;
|
||||
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
|
||||
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
|
||||
$line->qty = $object->lines[$i]->qty;
|
||||
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
|
||||
$line->remise_percent = $object->lines[$i]->remise_percent;
|
||||
$line->fk_product = $object->lines[$i]->fk_product;
|
||||
$line->info_bits = $object->lines[$i]->info_bits;
|
||||
$line->product_type = $object->lines[$i]->product_type;
|
||||
$line->rang = $object->lines[$i]->rang;
|
||||
$line->special_code = $object->lines[$i]->special_code;
|
||||
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
|
||||
$line->libelle = $object->lines[$i]->libelle;
|
||||
$line->desc = $object->lines[$i]->desc;
|
||||
$line->price = $object->lines[$i]->price;
|
||||
$line->subprice = $object->lines[$i]->subprice;
|
||||
$line->tva_tx = $object->lines[$i]->tva_tx;
|
||||
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
|
||||
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
|
||||
$line->qty = $object->lines[$i]->qty;
|
||||
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
|
||||
$line->remise_percent = $object->lines[$i]->remise_percent;
|
||||
$line->fk_product = $object->lines[$i]->fk_product;
|
||||
$line->info_bits = $object->lines[$i]->info_bits;
|
||||
$line->product_type = $object->lines[$i]->product_type;
|
||||
$line->rang = $object->lines[$i]->rang;
|
||||
$line->special_code = $object->lines[$i]->special_code;
|
||||
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
|
||||
$this->socid = $object->socid;
|
||||
$this->fk_project = $object->fk_project;
|
||||
$this->cond_reglement_id = $object->cond_reglement_id;
|
||||
$this->mode_reglement_id = $object->mode_reglement_id;
|
||||
$this->availability_id = $object->availability_id;
|
||||
$this->socid = $object->socid;
|
||||
$this->fk_project = $object->fk_project;
|
||||
$this->cond_reglement_id = $object->cond_reglement_id;
|
||||
$this->mode_reglement_id = $object->mode_reglement_id;
|
||||
$this->availability_id = $object->availability_id;
|
||||
$this->demand_reason_id = $object->demand_reason_id;
|
||||
$this->date_livraison = $object->date_livraison;
|
||||
$this->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contactid;
|
||||
$this->ref_client = $object->ref_client;
|
||||
$this->note = $object->note;
|
||||
$this->note_public = $object->note_public;
|
||||
$this->date_livraison = $object->date_livraison;
|
||||
$this->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contactid;
|
||||
$this->ref_client = $object->ref_client;
|
||||
$this->note = $object->note;
|
||||
$this->note_public = $object->note_public;
|
||||
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
$ret = $this->create($user);
|
||||
$ret = $this->create($user);
|
||||
|
||||
if ($ret > 0)
|
||||
{
|
||||
// Hook of thirdparty module
|
||||
if (! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($object,$ret,$this->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($ret > 0)
|
||||
{
|
||||
// Hook of thirdparty module
|
||||
if (! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($object,$ret,$this->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Ne pas passer par la commande provisoire
|
||||
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
|
||||
{
|
||||
$this->fetch($ret);
|
||||
$this->valid($user);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
// Ne pas passer par la commande provisoire
|
||||
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
|
||||
{
|
||||
$this->fetch($ret);
|
||||
$this->valid($user);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -998,13 +999,13 @@ class Commande extends CommonObject
|
||||
|
||||
// Clean parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
@ -1124,12 +1125,12 @@ class Commande extends CommonObject
|
||||
/**
|
||||
* Add line into array
|
||||
* $this->client doit etre charge
|
||||
* @param idproduct Id du produit a ajouter
|
||||
* @param qty Quantite
|
||||
* @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @remise_percent remise_percent Remise relative effectuee sur le produit
|
||||
* @return void
|
||||
* @param idproduct Id du produit a ajouter
|
||||
* @param qty Quantite
|
||||
* @param remise_percent Remise relative effectuee sur le produit
|
||||
* @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @return void
|
||||
* TODO Remplacer les appels a cette fonction par generation objet Ligne
|
||||
* insere dans tableau $this->products
|
||||
*/
|
||||
@ -1202,7 +1203,7 @@ class Commande extends CommonObject
|
||||
* @param id Id of object to load
|
||||
* @param ref Ref of object
|
||||
* @param ref_ext External reference of object
|
||||
* @param ref_int Internal reference of other object
|
||||
* @param ref_int Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($id, $ref='', $ref_ext='', $ref_int='')
|
||||
@ -1231,9 +1232,9 @@ class Commande extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = c.rowid AND el.targettype = '".$this->element."'";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if ($id) $sql.= " AND c.rowid=".$id;
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql) ;
|
||||
@ -1330,9 +1331,9 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Ajout d'une ligne remise fixe dans la commande, en base
|
||||
* \param idremise Id de la remise fixe
|
||||
* \return int >0 si ok, <0 si ko
|
||||
* Ajout d'une ligne remise fixe dans la commande, en base
|
||||
* @param idremise Id de la remise fixe
|
||||
* @return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function insert_discount($idremise)
|
||||
{
|
||||
@ -1405,9 +1406,9 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Reinitialize array lignes
|
||||
* \param only_product Return only physical products
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* Load array lines
|
||||
* @param only_product Return only physical products
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_lines($only_product=0)
|
||||
{
|
||||
@ -1558,12 +1559,12 @@ class Commande extends CommonObject
|
||||
*/
|
||||
function nb_expedition()
|
||||
{
|
||||
$sql = 'SELECT count(*)';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'element_element as el';
|
||||
$sql.= ' WHERE el.fk_source = '.$this->id;
|
||||
$sql.= " AND el.fk_target = e.rowid";
|
||||
$sql.= " AND el.targettype = 'shipping'";
|
||||
$sql = 'SELECT count(*)';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'element_element as el';
|
||||
$sql.= ' WHERE el.fk_source = '.$this->id;
|
||||
$sql.= " AND el.fk_target = e.rowid";
|
||||
$sql.= " AND el.targettype = 'shipping'";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1571,7 +1572,7 @@ class Commande extends CommonObject
|
||||
$row = $this->db->fetch_row($resql);
|
||||
return $row[0];
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
else dol_print_error($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1588,10 +1589,10 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie un tableau avec les stocks restant par produit
|
||||
* \param filtre_statut Filtre sur statut
|
||||
* \return int 0 si OK, <0 si KO
|
||||
* \todo FONCTION NON FINIE A FINIR
|
||||
* Renvoie un tableau avec les stocks restant par produit
|
||||
* @param filtre_statut Filtre sur statut
|
||||
* @return int 0 si OK, <0 si KO
|
||||
* TODO FONCTION NON FINIE A FINIR
|
||||
*/
|
||||
function stock_array($filtre_statut=-1)
|
||||
{
|
||||
@ -1625,9 +1626,9 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Supprime une ligne de la commande
|
||||
* \param idligne Id de la ligne a supprimer
|
||||
* \return int >0 si ok, 0 si rien a supprimer, <0 si ko
|
||||
* Delete an order line
|
||||
* @param lineid Id of line to delete
|
||||
* @return int >0 if OK, 0 if nothing to do, <0 if KO
|
||||
*/
|
||||
function deleteline($lineid)
|
||||
{
|
||||
@ -1700,10 +1701,10 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Applique une remise relative
|
||||
* \param user User qui positionne la remise
|
||||
* \param remise
|
||||
* \return int <0 si ko, >0 si ok
|
||||
* Applique une remise relative
|
||||
* @param user User qui positionne la remise
|
||||
* @param remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_remise($user, $remise)
|
||||
{
|
||||
@ -1733,10 +1734,10 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Applique une remise absolue
|
||||
* \param user User qui positionne la remise
|
||||
* \param remise
|
||||
* \return int <0 si ko, >0 si ok
|
||||
* Applique une remise absolue
|
||||
* @param user User qui positionne la remise
|
||||
* @param remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_remise_absolue($user, $remise)
|
||||
{
|
||||
@ -1769,8 +1770,8 @@ class Commande extends CommonObject
|
||||
|
||||
/**
|
||||
* Set the order date
|
||||
* @param user Object user
|
||||
* @param date_livraison Date delivery
|
||||
* @param user Object user making change
|
||||
* @param date Date
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_date($user, $date)
|
||||
@ -1802,10 +1803,10 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the planned delivery date
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param date_livraison Date de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
* Set the planned delivery date
|
||||
* @param user Objet utilisateur qui modifie
|
||||
* @param date_livraison Date de livraison
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function set_date_livraison($user, $date_livraison)
|
||||
{
|
||||
@ -1836,10 +1837,10 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Definit une adresse de livraison
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param adresse_livraison Adresse de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
* Set address
|
||||
* @param user Object user making change
|
||||
* @param fk_address Adress of delivery
|
||||
* @return int <0 ig KO, >0 if Ok
|
||||
*/
|
||||
function set_adresse_livraison($user, $fk_address)
|
||||
{
|
||||
@ -1862,11 +1863,11 @@ class Commande extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set delivery
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param delivery delai de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
/**
|
||||
* Set availability
|
||||
* @param user Object user making change
|
||||
* @param id If of availability delay
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_availability($user, $id)
|
||||
{
|
||||
@ -1891,10 +1892,10 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set source of demand
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param delivery delai de livraison
|
||||
* \return int <0 si ko, >0 si ok
|
||||
* Set source of demand
|
||||
* @param user Object user making change
|
||||
* @param id Id of source
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_demand_reason($user, $id)
|
||||
{
|
||||
@ -1935,7 +1936,7 @@ class Commande extends CommonObject
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
if ($brouillon) $sql.= " AND c.fk_statut = 0";
|
||||
if ($user) $sql.= " AND c.fk_user_author <> ".$user->id;
|
||||
if ($user) $sql.= " AND c.fk_user_author <> ".$user->id;
|
||||
$sql .= " ORDER BY c.date_commande DESC";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
@ -1963,9 +1964,9 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \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
|
||||
* Change les conditions de reglement de la commande
|
||||
* @param cond_reglement_id Id de la nouvelle condition de reglement
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function cond_reglement($cond_reglement_id)
|
||||
{
|
||||
@ -2029,10 +2030,10 @@ class Commande extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change le delai de livraison
|
||||
* \param mode Id du nouveau mode
|
||||
* \return int >0 si ok, <0 si ko
|
||||
/**
|
||||
* Change le delai de livraison
|
||||
* @param availability_id Id du nouveau mode
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function availability($availability_id)
|
||||
{
|
||||
@ -2177,7 +2178,7 @@ class Commande extends CommonObject
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
|
||||
{
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
dol_syslog("CustomerOrder::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
@ -2280,14 +2281,14 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Delete the customer order
|
||||
* \user User object
|
||||
* \return int <=0 if KO, >0 if OK
|
||||
* Delete the customer order
|
||||
* @param user User object
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
|
||||
$err = 0;
|
||||
|
||||
@ -2380,9 +2381,9 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
* @param user Objet user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
* @param user Objet user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
@ -2515,10 +2516,12 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
* @param withpicto Add picto into link
|
||||
* @param option Where point the link
|
||||
* @return string String with URL
|
||||
* Return clicable link of object (with eventually picto)
|
||||
* @param withpicto Add picto into link
|
||||
* @param option Where point the link
|
||||
* @param max Max length to show
|
||||
* @param short Use short labels
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0)
|
||||
{
|
||||
@ -2788,7 +2791,7 @@ class OrderLine
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
|
||||
var $oldline;
|
||||
|
||||
// From llx_commandedet
|
||||
@ -2887,9 +2890,9 @@ class OrderLine
|
||||
$this->rang = $objp->rang;
|
||||
|
||||
$this->ref = $objp->product_ref; // deprecated
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->libelle = $objp->product_libelle; // deprecated
|
||||
$this->product_label = $objp->product_libelle;
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->libelle = $objp->product_libelle; // deprecated
|
||||
$this->product_label = $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
@ -2951,17 +2954,17 @@ class OrderLine
|
||||
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
|
||||
if (empty($this->total_localtax1)) $this->total_localtax1=0;
|
||||
if (empty($this->total_localtax2)) $this->total_localtax2=0;
|
||||
if (empty($this->rang)) $this->rang=0;
|
||||
if (empty($this->remise)) $this->remise=0;
|
||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->rang)) $this->rang=0;
|
||||
if (empty($this->remise)) $this->remise=0;
|
||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
|
||||
// Check parameters
|
||||
if ($this->product_type < 0) return -1;
|
||||
// Check parameters
|
||||
if ($this->product_type < 0) return -1;
|
||||
|
||||
$this->db->begin();
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion dans base de la ligne
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
* \file htdocs/contact/class/contact.class.php
|
||||
* \ingroup societe
|
||||
* \brief File of contacts class
|
||||
* \version $Id$
|
||||
* \version $Id: contact.class.php,v 1.30 2011/07/04 09:36:29 eldy Exp $
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
||||
|
||||
@ -83,7 +83,6 @@ class Contact extends CommonObject
|
||||
/**
|
||||
* Constructor of class Contact
|
||||
* @param DB Habler d'acces base
|
||||
* @param id Id contact
|
||||
*/
|
||||
function Contact($DB)
|
||||
{
|
||||
@ -583,7 +582,7 @@ class Contact extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Charge le nombre d'elements auquel est lie ce contact
|
||||
* ref_facturation
|
||||
* ref_contrat
|
||||
@ -626,9 +625,10 @@ class Contact extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Efface le contact de la base
|
||||
* \return int <0 si ko, >0 si ok
|
||||
/**
|
||||
* Efface le contact de la base
|
||||
* @param notrigger Disable all trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($notrigger=0)
|
||||
{
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
* \file htdocs/core/class/commonobject.class.php
|
||||
* \ingroup core
|
||||
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
|
||||
* \version $Id: commonobject.class.php,v 1.143 2011/07/01 23:05:39 eldy Exp $
|
||||
* \version $Id: commonobject.class.php,v 1.144 2011/07/04 09:36:29 eldy Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -78,11 +78,12 @@ class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Add a link between element $this->element and a contact
|
||||
* \param fk_socpeople Id of contact to link
|
||||
* \param type_contact Type of contact (code or id)
|
||||
* \param source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* Add a link between element $this->element and a contact
|
||||
* @param fk_socpeople Id of contact to link
|
||||
* @param type_contact Type of contact (code or id)
|
||||
* @param source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
|
||||
* @param notrigger Disable all triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0)
|
||||
{
|
||||
@ -168,11 +169,11 @@ class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Update a link to contact line
|
||||
* \param rowid Id of line contact-element
|
||||
* \param statut New status of link
|
||||
* \param type_contact_id Id of contact type
|
||||
* \return int <0 if KO, >= 0 if OK
|
||||
* Update a link to contact line
|
||||
* @param rowid Id of line contact-element
|
||||
* @param statut New status of link
|
||||
* @param type_contact_id Id of contact type
|
||||
* @return int <0 if KO, >= 0 if OK
|
||||
*/
|
||||
function update_contact($rowid, $statut, $type_contact_id)
|
||||
{
|
||||
@ -194,9 +195,10 @@ class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Delete a link to contact line
|
||||
* \param rowid Id of link line to delete
|
||||
* \return statur >0 si ok, <0 si ko
|
||||
* Delete a link to contact line
|
||||
* @param rowid Id of contact link line to delete
|
||||
* @param notrigger Disable all triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function delete_contact($rowid,$notrigger=0)
|
||||
{
|
||||
@ -1321,8 +1323,8 @@ class CommonObject
|
||||
/**
|
||||
* Set statut of an object
|
||||
* @param statut Statut to set
|
||||
* @param elementid Id of element to force (use this->id by default)
|
||||
* @param elementtype Type of element to force (use ->this->element by default)
|
||||
* @param elementId Id of element to force (use this->id by default)
|
||||
* @param elementType Type of element to force (use ->this->element by default)
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function setStatut($statut,$elementId='',$elementType='')
|
||||
@ -1664,6 +1666,8 @@ class CommonObject
|
||||
* TODO Edit templates to use global variables and include them directly in controller call
|
||||
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
|
||||
* @param $dateSelector 1=Show also date range input fields
|
||||
* @param $seller Object thirdparty who sell
|
||||
* @param $buyer Object thirdparty who buy
|
||||
*/
|
||||
function formAddPredefinedProduct($dateSelector,$seller,$buyer)
|
||||
{
|
||||
@ -1699,10 +1703,11 @@ class CommonObject
|
||||
* TODO Move this into an output class file (htmlline.class.php)
|
||||
* If lines are into a template, title must also be into a template
|
||||
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
|
||||
* @param $seller Object of seller third party
|
||||
* @param $buyer Object of buyer third party
|
||||
* @param $selected Object line selected
|
||||
* @param $dateSelector 1=Show also date range input fields
|
||||
* @param $action Action code
|
||||
* @param $seller Object of seller third party
|
||||
* @param $buyer Object of buyer third party
|
||||
* @param $selected Object line selected
|
||||
* @param $dateSelector 1=Show also date range input fields
|
||||
*/
|
||||
function printObjectLines($action='viewline',$seller,$buyer,$selected=0,$dateSelector=0)
|
||||
{
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
* \file htdocs/fourn/class/fournisseur.commande.class.php
|
||||
* \ingroup fournisseur,commande
|
||||
* \brief File of class to manage suppliers orders
|
||||
* \version $Id$
|
||||
* \version $Id: fournisseur.commande.class.php,v 1.47 2011/07/04 09:36:29 eldy Exp $
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
@ -49,27 +49,27 @@ class CommandeFournisseur extends Commande
|
||||
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
var $ref; // TODO deprecated
|
||||
var $product_ref;
|
||||
var $ref_supplier;
|
||||
var $product_ref;
|
||||
var $ref_supplier;
|
||||
var $brouillon;
|
||||
var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
|
||||
// -> 7=Canceled/Never received -> (reopen) 3=Process runing
|
||||
// -> 6=Canceled -> (reopen) 2=Approved
|
||||
// -> 9=Refused -> (reopen) 1=Validated
|
||||
var $socid;
|
||||
var $fourn_id;
|
||||
var $socid;
|
||||
var $fourn_id;
|
||||
var $date;
|
||||
var $date_commande;
|
||||
var $total_ht;
|
||||
var $total_tva;
|
||||
var $date_commande;
|
||||
var $total_ht;
|
||||
var $total_tva;
|
||||
var $total_localtax1; // Total Local tax 1
|
||||
var $total_localtax2; // Total Local tax 2
|
||||
var $total_ttc;
|
||||
var $source;
|
||||
var $note;
|
||||
var $note_public;
|
||||
var $model_pdf;
|
||||
var $fk_project;
|
||||
var $total_ttc;
|
||||
var $source;
|
||||
var $note;
|
||||
var $note_public;
|
||||
var $model_pdf;
|
||||
var $fk_project;
|
||||
var $cond_reglement_id;
|
||||
var $cond_reglement_code;
|
||||
var $mode_reglement_id;
|
||||
@ -247,7 +247,7 @@ class CommandeFournisseur extends Commande
|
||||
* @param user User making action
|
||||
* @param statut Status of order
|
||||
* @param datelog Date of change
|
||||
* @param comment Comment
|
||||
* @param comment Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function log($user, $statut, $datelog, $comment='')
|
||||
@ -278,7 +278,7 @@ class CommandeFournisseur extends Commande
|
||||
function valid($user)
|
||||
{
|
||||
global $langs,$conf;
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -479,18 +479,18 @@ class CommandeFournisseur extends Commande
|
||||
global $langs;
|
||||
$langs->load('orders');
|
||||
|
||||
// List of language codes for status
|
||||
$statutshort[0] = 'StatusOrderDraftShort';
|
||||
$statutshort[1] = 'StatusOrderValidatedShort';
|
||||
$statutshort[2] = 'StatusOrderApprovedShort';
|
||||
$statutshort[3] = 'StatusOrderOnProcessShort';
|
||||
$statutshort[4] = 'StatusOrderReceivedPartiallyShort';
|
||||
$statutshort[5] = 'StatusOrderReceivedAllShort';
|
||||
$statutshort[6] = 'StatusOrderCanceledShort';
|
||||
$statutshort[7] = 'StatusOrderCanceledShort';
|
||||
$statutshort[9] = 'StatusOrderRefusedShort';
|
||||
// List of language codes for status
|
||||
$statutshort[0] = 'StatusOrderDraftShort';
|
||||
$statutshort[1] = 'StatusOrderValidatedShort';
|
||||
$statutshort[2] = 'StatusOrderApprovedShort';
|
||||
$statutshort[3] = 'StatusOrderOnProcessShort';
|
||||
$statutshort[4] = 'StatusOrderReceivedPartiallyShort';
|
||||
$statutshort[5] = 'StatusOrderReceivedAllShort';
|
||||
$statutshort[6] = 'StatusOrderCanceledShort';
|
||||
$statutshort[7] = 'StatusOrderCanceledShort';
|
||||
$statutshort[9] = 'StatusOrderRefusedShort';
|
||||
|
||||
if ($mode == 0)
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
@ -618,6 +618,7 @@ class CommandeFournisseur extends Commande
|
||||
/**
|
||||
* Accept an order
|
||||
* @param user Object user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function approve($user)
|
||||
{
|
||||
@ -647,7 +648,7 @@ class CommandeFournisseur extends Commande
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
{
|
||||
// Product with reference
|
||||
if ($this->lines[$i]->fk_product > 0)
|
||||
if ($this->lines[$i]->fk_product > 0)
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We decrement stock of product (and sub-products)
|
||||
@ -739,9 +740,9 @@ class CommandeFournisseur extends Commande
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel an approved order
|
||||
* Cancel an approved order.
|
||||
* L'annulation se fait apres l'approbation
|
||||
* @param user User making action
|
||||
* @remarks L'annulation se fait apres l'approbation
|
||||
*/
|
||||
function Cancel($user)
|
||||
{
|
||||
@ -800,6 +801,11 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
/**
|
||||
* Send a supplier order to supplier
|
||||
* @param user User making change
|
||||
* @param date Date
|
||||
* @param methode Method
|
||||
* @param comment Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function commande($user, $date, $methode, $comment='')
|
||||
{
|
||||
@ -912,14 +918,14 @@ class CommandeFournisseur extends Commande
|
||||
/**
|
||||
* Add order line
|
||||
* @param desc Description
|
||||
* @param pu Unit price
|
||||
* @param pu_ht Unit price
|
||||
* @param qty Quantity
|
||||
* @param txtva Taux tva
|
||||
* @param txlocaltax1 Localtax1 tax
|
||||
* @param txlocaltax2 Localtax2 tax
|
||||
* @param fk_product Id produit
|
||||
* @param fk_prod_fourn_price Id supplier price
|
||||
* @param fournref Supplier reference
|
||||
* @param fourn_ref Supplier reference
|
||||
* @param remise_percent Remise
|
||||
* @param price_base_type HT or TTC
|
||||
* @param pu_ttc Unit price TTC
|
||||
@ -1117,13 +1123,13 @@ class CommandeFournisseur extends Commande
|
||||
$mouv = new MouvementStock($this->db);
|
||||
if ($product > 0)
|
||||
{
|
||||
$result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$mouv->error;
|
||||
dol_syslog("CommandeFournisseur::DispatchProduct ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
$result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$mouv->error;
|
||||
dol_syslog("CommandeFournisseur::DispatchProduct ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -1159,15 +1165,15 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
dol_syslog("Fournisseur.commande.class::deleteline sql=".$sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result=$this->update_price();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
$result=$this->update_price();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1176,8 +1182,8 @@ class CommandeFournisseur extends Commande
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Delete an order
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* Delete an order
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
@ -1229,8 +1235,7 @@ class CommandeFournisseur extends Commande
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Return list of order methods
|
||||
*/
|
||||
function get_methodes_commande()
|
||||
{
|
||||
@ -1295,8 +1300,8 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
/**
|
||||
* Change le mode de reglement
|
||||
* @param mode Id du nouveau mode
|
||||
* @return int >0 si ok, <0 si ko
|
||||
* @param mode_reglement_id Id du nouveau mode
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function mode_reglement($mode_reglement_id)
|
||||
{
|
||||
@ -1331,6 +1336,7 @@ class CommandeFournisseur extends Commande
|
||||
* @param user User that input data
|
||||
* @param date Date of reception
|
||||
* @param type Type of receipt
|
||||
* @param comment Comment
|
||||
*/
|
||||
function Livraison($user, $date, $type, $comment)
|
||||
{
|
||||
@ -1388,7 +1394,8 @@ class CommandeFournisseur extends Commande
|
||||
/**
|
||||
* Cree la commande depuis une propale existante
|
||||
* @param user Utilisateur qui cree
|
||||
* @param propale_id id de la propale qui sert de modele
|
||||
* @param idc Id de la propale qui sert de modele
|
||||
* @param comclientid Id thirdparty
|
||||
*/
|
||||
function updateFromCommandeClient($user, $idc, $comclientid)
|
||||
{
|
||||
@ -1425,8 +1432,12 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
|
||||
/**
|
||||
* Met a jour les notes
|
||||
* @return int <0 si ko, >=0 si ok
|
||||
* Update notes
|
||||
* @param user
|
||||
* @param note
|
||||
* @param note_public
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
* TODO Use instead update_note_public and update_note
|
||||
*/
|
||||
function UpdateNote($user, $note, $note_public)
|
||||
{
|
||||
@ -1457,10 +1468,8 @@ class CommandeFournisseur extends Commande
|
||||
return $result ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
/**
|
||||
* Get list of user that can approve an order
|
||||
*/
|
||||
function ReadApprobators()
|
||||
{
|
||||
@ -1500,6 +1509,7 @@ class CommandeFournisseur extends Commande
|
||||
/**
|
||||
* Tag order with a particular status
|
||||
* @param user Object user that change status
|
||||
* @param status New status
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setStatus($user,$status)
|
||||
@ -1688,7 +1698,7 @@ class CommandeFournisseur extends Commande
|
||||
$this->specimen=1;
|
||||
$this->socid = 1;
|
||||
$this->date = time();
|
||||
$this->date_commande = time();
|
||||
$this->date_commande = time();
|
||||
$this->date_lim_reglement=$this->date+3600*24*30;
|
||||
$this->cond_reglement_code = 'RECEP';
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
@ -1703,14 +1713,14 @@ class CommandeFournisseur extends Commande
|
||||
$line->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$line->qty=1;
|
||||
$line->subprice=100;
|
||||
$line->price=100;
|
||||
$line->tva_tx=19.6;
|
||||
$line->localtax1_tx=0;
|
||||
$line->localtax2_tx=0;
|
||||
$line->remise_percent=10;
|
||||
$line->total_ht=90;
|
||||
$line->total_ttc=107.64; // 90 * 1.196
|
||||
$line->total_tva=17.64;
|
||||
$line->price=100;
|
||||
$line->tva_tx=19.6;
|
||||
$line->localtax1_tx=0;
|
||||
$line->localtax2_tx=0;
|
||||
$line->remise_percent=10;
|
||||
$line->total_ht=90;
|
||||
$line->total_ttc=107.64; // 90 * 1.196
|
||||
$line->total_tva=17.64;
|
||||
$line->ref_fourn='SUPPLIER_REF_'.$xnbp;
|
||||
$prodid = rand(1, $num_prods);
|
||||
$line->fk_product=$prodids[$prodid];
|
||||
@ -1726,48 +1736,48 @@ class CommandeFournisseur extends Commande
|
||||
$this->total_ttc = $xnbp*119.6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
* @param user Objet user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
global $conf, $user;
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
* @param user Objet user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$now=gmmktime();
|
||||
$now=gmmktime();
|
||||
|
||||
$this->nbtodo=$this->nbtodolate=0;
|
||||
$clause = " WHERE";
|
||||
$this->nbtodo=$this->nbtodolate=0;
|
||||
$clause = " WHERE";
|
||||
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
$clause = " AND";
|
||||
}
|
||||
$sql.= $clause." c.entity = ".$conf->entity;
|
||||
$sql.= " AND (c.fk_statut BETWEEN 1 AND 2)";
|
||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
$clause = " AND";
|
||||
}
|
||||
$sql.= $clause." c.entity = ".$conf->entity;
|
||||
$sql.= " AND (c.fk_statut BETWEEN 1 AND 2)";
|
||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nbtodo++;
|
||||
if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nbtodo++;
|
||||
if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
/**
|
||||
* \file htdocs/lib/CMailFile.class.php
|
||||
* \brief File of class to send emails (with attachments or not)
|
||||
* \version $Id: CMailFile.class.php,v 1.142 2011/07/02 16:48:31 eldy Exp $
|
||||
* \version $Id: CMailFile.class.php,v 1.143 2011/07/04 09:36:29 eldy Exp $
|
||||
* \author Dan Potter.
|
||||
* \author Eric Seigne
|
||||
* \author Laurent Destailleur.
|
||||
@ -86,20 +86,20 @@ class CMailFile
|
||||
|
||||
|
||||
/**
|
||||
* \brief CMailFile
|
||||
* \param subject Topic/Subject of mail
|
||||
* \param to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||
* \param from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||
* \param msg Message
|
||||
* \param filename_list List of files to attach (full path of filename on file system)
|
||||
* \param mimetype_list List of MIME type of attached files
|
||||
* \param mimefilename_list List of attached file name in message
|
||||
* \param addr_cc Email cc
|
||||
* \param addr_bcc Email bcc
|
||||
* \param deliveryreceipt Ask a delivery receipt
|
||||
* \param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||
* \param error_to Email errors
|
||||
* \param css Css option
|
||||
* CMailFile
|
||||
* @param subject Topic/Subject of mail
|
||||
* @param to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||
* @param from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||
* @param msg Message
|
||||
* @param filename_list List of files to attach (full path of filename on file system)
|
||||
* @param mimetype_list List of MIME type of attached files
|
||||
* @param mimefilename_list List of attached file name in message
|
||||
* @param addr_cc Email cc
|
||||
* @param addr_bcc Email bcc
|
||||
* @param deliveryreceipt Ask a delivery receipt
|
||||
* @param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||
* @param errors_to Email errors
|
||||
* @param css Css option
|
||||
*/
|
||||
function CMailFile($subject,$to,$from,$msg,
|
||||
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
||||
@ -781,9 +781,8 @@ class CMailFile
|
||||
|
||||
/**
|
||||
* Try to create a socket connection
|
||||
*
|
||||
* @param $host. Add ssl:// for SSL/TLS.
|
||||
* @param $port. Example: 25, 465
|
||||
* @param $host Add ssl:// for SSL/TLS.
|
||||
* @param $port Example: 25, 465
|
||||
* @return Socket id if ok, 0 if KO
|
||||
*/
|
||||
function check_server_port($host,$port)
|
||||
@ -939,7 +938,6 @@ class CMailFile
|
||||
|
||||
/**
|
||||
* Return an address for SMTP protocol
|
||||
*
|
||||
* @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'
|
||||
* @param format 0=Auto, 1=emails with <>, 2=emails without <>
|
||||
* @param encode 1=Encode name to RFC2822
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
/**
|
||||
* \file htdocs/lib/CSMSFile.class.php
|
||||
* \brief File of class to send sms
|
||||
* \version $Id$
|
||||
* \version $Id: CSMSFile.class.php,v 1.4 2011/07/04 09:36:29 eldy Exp $
|
||||
* \author Laurent Destailleur.
|
||||
*/
|
||||
|
||||
@ -54,6 +54,9 @@ class CSMSFile
|
||||
* @param from Sender SMS
|
||||
* @param msg Message
|
||||
* @param deliveryreceipt Ask a delivery receipt
|
||||
* @param deferred Deferred or not
|
||||
* @param priority Priority
|
||||
* @param class Class
|
||||
*/
|
||||
function CSMSFile($to,$from,$msg,$deliveryreceipt=0,$deferred=0,$priority=3,$class=1)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user