Merge pull request #5788 from atm-florian/dev_CommandeLine_Class_CleanDeclaration
wotk on declaration method OrderLine
This commit is contained in:
commit
5bf365e091
@ -183,7 +183,7 @@ if (empty($reshook))
|
|||||||
// Remove a product line
|
// Remove a product line
|
||||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer)
|
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$result = $object->deleteline($lineid);
|
$result = $object->deleteline($user, $lineid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
|
|||||||
@ -401,7 +401,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->commande->deleteline($lineid);
|
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
||||||
if ($updateRes == 1) {
|
if ($updateRes == 1) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -365,7 +365,7 @@ class Orders extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->commande->deleteline($lineid);
|
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
||||||
if ($updateRes == 1) {
|
if ($updateRes == 1) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1220,7 +1220,7 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
|
||||||
{
|
{
|
||||||
global $mysoc, $conf, $langs;
|
global $mysoc, $conf, $langs, $user;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit", LOG_DEBUG);
|
||||||
|
|
||||||
@ -1373,7 +1373,7 @@ class Commande extends CommonOrder
|
|||||||
$this->line->array_options=$array_options;
|
$this->line->array_options=$array_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$this->line->insert();
|
$result=$this->line->insert($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
@ -1972,10 +1972,11 @@ class Commande extends CommonOrder
|
|||||||
/**
|
/**
|
||||||
* Delete an order line
|
* Delete an order line
|
||||||
*
|
*
|
||||||
|
* @param User $user User object
|
||||||
* @param int $lineid Id of line to delete
|
* @param int $lineid Id of line to delete
|
||||||
* @return int >0 if OK, 0 if nothing to do, <0 if KO
|
* @return int >0 if OK, 0 if nothing to do, <0 if KO
|
||||||
*/
|
*/
|
||||||
function deleteline($lineid)
|
function deleteline($user=null, $lineid=0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT)
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
@ -2002,7 +2003,7 @@ class Commande extends CommonOrder
|
|||||||
// For triggers
|
// For triggers
|
||||||
$line->fetch($lineid);
|
$line->fetch($lineid);
|
||||||
|
|
||||||
if ($line->delete() > 0)
|
if ($line->delete($user) > 0)
|
||||||
{
|
{
|
||||||
$result=$this->update_price(1);
|
$result=$this->update_price(1);
|
||||||
|
|
||||||
@ -2740,7 +2741,7 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null)
|
||||||
{
|
{
|
||||||
global $conf, $mysoc, $langs;
|
global $conf, $mysoc, $langs, $user;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
|
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
@ -2885,7 +2886,7 @@ class Commande extends CommonOrder
|
|||||||
$this->line->array_options=$array_options;
|
$this->line->array_options=$array_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$this->line->update();
|
$result=$this->line->update($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
@ -3805,9 +3806,11 @@ class OrderLine extends CommonOrderLine
|
|||||||
/**
|
/**
|
||||||
* Delete line in database
|
* Delete line in database
|
||||||
*
|
*
|
||||||
|
* @param User $user User that modify
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 si ko, >0 si ok
|
* @return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function delete()
|
function delete($user=null, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
@ -3833,10 +3836,13 @@ class OrderLine extends CommonOrderLine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('LINEORDER_DELETE',$user);
|
$result=$this->call_trigger('LINEORDER_DELETE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -3861,12 +3867,13 @@ class OrderLine extends CommonOrderLine
|
|||||||
/**
|
/**
|
||||||
* Insert line into database
|
* Insert line into database
|
||||||
*
|
*
|
||||||
|
* @param User $user User that modify
|
||||||
* @param int $notrigger 1 = disable triggers
|
* @param int $notrigger 1 = disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function insert($notrigger=0)
|
function insert($user=null, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -4004,12 +4011,13 @@ class OrderLine extends CommonOrderLine
|
|||||||
/**
|
/**
|
||||||
* Update the line object into db
|
* Update the line object into db
|
||||||
*
|
*
|
||||||
|
* @param User $user User that modify
|
||||||
* @param int $notrigger 1 = disable triggers
|
* @param int $notrigger 1 = disable triggers
|
||||||
* @return int <0 si ko, >0 si ok
|
* @return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function update($notrigger=0)
|
function update($user=null, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user;
|
global $conf,$langs;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user