forked from Wavyzz/dolibarr
Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/categories/class/categorie.class.php htdocs/core/class/commondocgenerator.class.php htdocs/core/lib/functions.lib.php htdocs/core/modules/DolibarrModules.class.php htdocs/filefunc.inc.php htdocs/societe/class/societe.class.php htdocs/supplier_proposal/class/supplier_proposal.class.php
This commit is contained in:
@@ -49,6 +49,7 @@ class Categorie extends CommonObject
|
|||||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
||||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
||||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||||
|
|
||||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
||||||
const TYPE_PROJECT = 6;
|
const TYPE_PROJECT = 6;
|
||||||
const TYPE_BANK_LINE = 'bank_line';
|
const TYPE_BANK_LINE = 'bank_line';
|
||||||
@@ -1174,11 +1175,11 @@ class Categorie extends CommonObject
|
|||||||
*/
|
*/
|
||||||
if($obj[0] > 0 && $obj[0] != $this->id)
|
if($obj[0] > 0 && $obj[0] != $this->id)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." exist rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." and parent ".$this->fk_parent." exists: rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent.": rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1411,7 +1411,7 @@ class Commande extends CommonOrder
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@@ -475,7 +475,13 @@ class FactureRec extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
|
||||||
dol_syslog($sql);
|
dol_syslog($sql);
|
||||||
if (! $this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
// Delete linked object
|
||||||
|
$res = $this->deleteObjectLinked();
|
||||||
|
if ($res < 0) $error=-3;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
$error=-1;
|
$error=-1;
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
|
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
|
||||||
|
|
||||||
$array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs),
|
$array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs),
|
||||||
$array_key.'already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'),
|
$array_key.'_already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'),
|
||||||
|
|
||||||
// Remain to pay with all know infrmation (except open direct debit requests)
|
// Remain to pay with all know infrmation (except open direct debit requests)
|
||||||
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs),
|
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs),
|
||||||
|
|||||||
@@ -2463,12 +2463,12 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
|
|||||||
* MAIN_DISABLE_TRUNC=1 can disable all truncings
|
* MAIN_DISABLE_TRUNC=1 can disable all truncings
|
||||||
*
|
*
|
||||||
* @param string $string String to truncate
|
* @param string $string String to truncate
|
||||||
* @param int $size Max string size visible. 0 for no limit. Final string size can be 1 more (if size was max+1) or 3 more (if we added ...)
|
* @param int $size Max string size visible (excluding ...). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added ..., or if size was max+1 or max+2 or max+3 so it does not worse to replace with ...)
|
||||||
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
|
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
|
||||||
* @param string $stringencoding Tell what is source string encoding
|
* @param string $stringencoding Tell what is source string encoding
|
||||||
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
|
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
|
||||||
* @param int $display Trunc is use to display and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
|
* @param int $display Trunc is use to display and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
|
||||||
* @return string Truncated string
|
* @return string Truncated string. WARNING: length is never higher than $size if $nodot is set, but can be 3 chars higher otherwise.
|
||||||
*/
|
*/
|
||||||
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
|
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
|
||||||
{
|
{
|
||||||
@@ -2484,9 +2484,10 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
if ($trunc == 'right')
|
if ($trunc == 'right')
|
||||||
{
|
{
|
||||||
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
||||||
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:1)))
|
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
|
||||||
return dol_substr($newstring,0,$size,$stringencoding).($nodot?'':'...');
|
return dol_substr($newstring,0,$size,$stringencoding).($nodot?'':'...');
|
||||||
else
|
else
|
||||||
|
//return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string;
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
elseif ($trunc == 'middle')
|
elseif ($trunc == 'middle')
|
||||||
@@ -2504,7 +2505,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
elseif ($trunc == 'left')
|
elseif ($trunc == 'left')
|
||||||
{
|
{
|
||||||
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
||||||
if (dol_strlen($newstring,$stringencoding) > ($size+1))
|
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
|
||||||
return '...'.dol_substr($newstring,dol_strlen($newstring,$stringencoding) - $size,$size,$stringencoding);
|
return '...'.dol_substr($newstring,dol_strlen($newstring,$stringencoding) - $size,$size,$stringencoding);
|
||||||
else
|
else
|
||||||
return $string;
|
return $string;
|
||||||
|
|||||||
@@ -1508,11 +1508,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
|
|
||||||
// Clean
|
// Clean
|
||||||
if (empty($visible)) $visible='0';
|
if (empty($visible)) $visible='0';
|
||||||
if (empty($val)) $val='';
|
if (empty($val) && $val != '0') $val='';
|
||||||
|
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT count(*)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
||||||
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$name."'";
|
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'";
|
||||||
$sql.= " AND entity = ".$entity;
|
$sql.= " AND entity = ".$entity;
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
@@ -1526,7 +1526,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$sql.= " VALUES (";
|
$sql.= " VALUES (";
|
||||||
$sql.= $this->db->encrypt($name,1);
|
$sql.= $this->db->encrypt($name,1);
|
||||||
$sql.= ",'".$type."'";
|
$sql.= ",'".$type."'";
|
||||||
$sql.= ",".($val?$this->db->encrypt($val,1):"''");
|
$sql.= ",".(($val != '')?$this->db->encrypt($val,1):"''");
|
||||||
$sql.= ",".($note?"'".$this->db->escape($note)."'":"null");
|
$sql.= ",".($note?"'".$this->db->escape($note)."'":"null");
|
||||||
$sql.= ",'".$visible."'";
|
$sql.= ",'".$visible."'";
|
||||||
$sql.= ",".$entity;
|
$sql.= ",".$entity;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
}
|
}
|
||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->posxprogress=126; // Only displayed for situation invoices
|
$this->posxprogress=126; // Only displayed for situation invoices
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
}
|
}
|
||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||||||
$this->posxqty=145;
|
$this->posxqty=145;
|
||||||
$this->posxdiscount=162;
|
$this->posxdiscount=162;
|
||||||
$this->postotalht=174;
|
$this->postotalht=174;
|
||||||
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup;
|
||||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||||
if ($this->page_largeur < 210) // To work with US executive format
|
if ($this->page_largeur < 210) // To work with US executive format
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
public $fk_element = 'fk_commande';
|
public $fk_element = 'fk_commande';
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
public $picto='order';
|
public $picto='order';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@@ -132,9 +132,9 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
* Draft status
|
* Draft status
|
||||||
*/
|
*/
|
||||||
const STATUS_DRAFT = 0;
|
const STATUS_DRAFT = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@@ -318,7 +318,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$line->subprice = $objp->subprice;
|
$line->subprice = $objp->subprice;
|
||||||
$line->pu_ht = $objp->subprice;
|
$line->pu_ht = $objp->subprice;
|
||||||
$line->remise_percent = $objp->remise_percent;
|
$line->remise_percent = $objp->remise_percent;
|
||||||
|
|
||||||
$line->vat_src_code = $objp->vat_src_code;
|
$line->vat_src_code = $objp->vat_src_code;
|
||||||
$line->total_ht = $objp->total_ht;
|
$line->total_ht = $objp->total_ht;
|
||||||
$line->total_tva = $objp->total_tva;
|
$line->total_tva = $objp->total_tva;
|
||||||
@@ -615,7 +615,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
$picto='order';
|
$picto='order';
|
||||||
$url = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$this->id;
|
||||||
|
|
||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
@@ -627,7 +627,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
@@ -1378,7 +1378,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
$desc=trim($desc);
|
$desc=trim($desc);
|
||||||
$ref_supplier=''; // Ref of supplier price when we add line
|
$ref_supplier=''; // Ref of supplier price when we add line
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($qty < 1 && ! $fk_product)
|
if ($qty < 1 && ! $fk_product)
|
||||||
{
|
{
|
||||||
@@ -1402,7 +1402,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
{
|
{
|
||||||
$product_type = $prod->type;
|
$product_type = $prod->type;
|
||||||
$label = $prod->label;
|
$label = $prod->label;
|
||||||
|
|
||||||
// We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
|
// We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
|
||||||
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
|
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
|
||||||
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', $this->fk_soc); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc
|
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', $this->fk_soc); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc
|
||||||
@@ -1422,7 +1422,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
|
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dol_syslog(get_class($this)."::addline we did not found supplier price, so we can't guess unit price");
|
dol_syslog(get_class($this)."::addline we did not found supplier price, so we can't guess unit price");
|
||||||
//$pu = $prod->fourn_pu; // We do not overwrite unit price
|
//$pu = $prod->fourn_pu; // We do not overwrite unit price
|
||||||
//$ref = $prod->ref_fourn; // We do not overwrite ref supplier price
|
//$ref = $prod->ref_fourn; // We do not overwrite ref supplier price
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1468,7 +1468,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$vat_src_code = $reg[1];
|
$vat_src_code = $reg[1];
|
||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx,$pu_ht_devise);
|
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx,$pu_ht_devise);
|
||||||
$total_ht = $tabprice[0];
|
$total_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
@@ -1487,7 +1487,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$localtax2_type=$localtaxes_type[2];
|
$localtax2_type=$localtaxes_type[2];
|
||||||
|
|
||||||
$subprice = price2num($pu,'MU');
|
$subprice = price2num($pu,'MU');
|
||||||
|
|
||||||
$rangmax = $this->line_max();
|
$rangmax = $this->line_max();
|
||||||
$rang = $rangmax + 1;
|
$rang = $rangmax + 1;
|
||||||
|
|
||||||
@@ -1513,7 +1513,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$this->line->subprice=$pu_ht;
|
$this->line->subprice=$pu_ht;
|
||||||
$this->line->rang=$this->rang;
|
$this->line->rang=$this->rang;
|
||||||
$this->line->info_bits=$info_bits;
|
$this->line->info_bits=$info_bits;
|
||||||
|
|
||||||
$this->line->vat_src_code=$vat_src_code;
|
$this->line->vat_src_code=$vat_src_code;
|
||||||
$this->line->total_ht=$total_ht;
|
$this->line->total_ht=$total_ht;
|
||||||
$this->line->total_tva=$total_tva;
|
$this->line->total_tva=$total_tva;
|
||||||
@@ -1553,7 +1553,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$this->thirdparty); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@@ -2001,7 +2001,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$old_statut = $this->statut;
|
$old_statut = $this->statut;
|
||||||
$this->statut = $statut;
|
$this->statut = $statut;
|
||||||
$this->actionmsg2 = $comment;
|
$this->actionmsg2 = $comment;
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('ORDER_SUPPLIER_RECEIVE',$user);
|
$result=$this->call_trigger('ORDER_SUPPLIER_RECEIVE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
@@ -2334,7 +2334,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$vat_src_code = $reg[1];
|
$vat_src_code = $reg[1];
|
||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||||
$total_ht = $tabprice[0];
|
$total_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
@@ -2819,7 +2819,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calc status regarding to dispatched stock
|
* Calc status regarding to dispatched stock
|
||||||
*
|
*
|
||||||
@@ -2828,7 +2828,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
* @param string $comment Comment
|
* @param string $comment Comment
|
||||||
* @return int <0 if KO, 0 if not applicable, >0 if OK
|
* @return int <0 if KO, 0 if not applicable, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function calcAndSetStatusDispatch(User $user, $closeopenorder=1, $comment='')
|
public function calcAndSetStatusDispatch(User $user, $closeopenorder=1, $comment='')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@@ -2845,14 +2845,14 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$filter['t.status']=1;
|
$filter['t.status']=1;
|
||||||
}
|
}
|
||||||
$ret=$supplierorderdispatch->fetchAll('','',0,0,$filter);
|
$ret=$supplierorderdispatch->fetchAll('','',0,0,$filter);
|
||||||
if ($ret<0)
|
if ($ret<0)
|
||||||
{
|
{
|
||||||
$this->error=$supplierorderdispatch->error; $this->errors=$supplierorderdispatch->errors;
|
$this->error=$supplierorderdispatch->error; $this->errors=$supplierorderdispatch->errors;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0)
|
if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0)
|
||||||
{
|
{
|
||||||
//Build array with quantity deliverd by product
|
//Build array with quantity deliverd by product
|
||||||
foreach($supplierorderdispatch->lines as $line) {
|
foreach($supplierorderdispatch->lines as $line) {
|
||||||
@@ -2861,12 +2861,12 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
foreach($this->lines as $line) {
|
foreach($this->lines as $line) {
|
||||||
$qtywished[$line->fk_product]+=$line->qty;
|
$qtywished[$line->fk_product]+=$line->qty;
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_liv = dol_now();
|
$date_liv = dol_now();
|
||||||
|
|
||||||
//Compare array
|
//Compare array
|
||||||
$diff_array=array_diff_assoc($qtydelivered,$qtywished);
|
$diff_array=array_diff_assoc($qtydelivered,$qtywished);
|
||||||
|
|
||||||
if (count($diff_array)==0) //No diff => mean everythings is received
|
if (count($diff_array)==0) //No diff => mean everythings is received
|
||||||
{
|
{
|
||||||
if ($closeopenorder)
|
if ($closeopenorder)
|
||||||
@@ -2888,8 +2888,8 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Diff => received partially
|
//Diff => received partially
|
||||||
$ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
|
$ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can'
|
||||||
@@ -3014,12 +3014,12 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
$this->date_start = $this->db->jdate($objp->date_start);
|
$this->date_start = $this->db->jdate($objp->date_start);
|
||||||
$this->date_end = $this->db->jdate($objp->date_end);
|
$this->date_end = $this->db->jdate($objp->date_end);
|
||||||
$this->fk_unit = $objp->fk_unit;
|
$this->fk_unit = $objp->fk_unit;
|
||||||
|
|
||||||
$this->multicurrency_subprice = $objp->multicurrency_subprice;
|
$this->multicurrency_subprice = $objp->multicurrency_subprice;
|
||||||
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||||
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||||
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -3208,7 +3208,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
$sql.= ", subprice='".price2num($this->subprice)."'";
|
$sql.= ", subprice='".price2num($this->subprice)."'";
|
||||||
//$sql.= ",remise='".price2num($remise)."'";
|
//$sql.= ",remise='".price2num($remise)."'";
|
||||||
$sql.= ", remise_percent='".price2num($this->remise_percent)."'";
|
$sql.= ", remise_percent='".price2num($this->remise_percent)."'";
|
||||||
|
|
||||||
$sql.= ", vat_src_code = '".(empty($this->vat_src_code)?'':$this->vat_src_code)."'";
|
$sql.= ", vat_src_code = '".(empty($this->vat_src_code)?'':$this->vat_src_code)."'";
|
||||||
$sql.= ", tva_tx='".price2num($this->tva_tx)."'";
|
$sql.= ", tva_tx='".price2num($this->tva_tx)."'";
|
||||||
$sql.= ", localtax1_tx='".price2num($this->total_localtax1)."'";
|
$sql.= ", localtax1_tx='".price2num($this->total_localtax1)."'";
|
||||||
|
|||||||
@@ -1430,7 +1430,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la facture meme
|
// Mise a jour informations denormalisees au niveau de la facture meme
|
||||||
$result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$this->thirdparty); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@@ -882,8 +882,6 @@ class Societe extends CommonObject
|
|||||||
$sql .= ', multicurrency_code = \''.$this->db->escape($this->multicurrency_code)."'";
|
$sql .= ', multicurrency_code = \''.$this->db->escape($this->multicurrency_code)."'";
|
||||||
$sql .= " WHERE rowid = '" . $id ."'";
|
$sql .= " WHERE rowid = '" . $id ."'";
|
||||||
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Update", LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@@ -978,11 +976,12 @@ class Societe extends CommonObject
|
|||||||
{
|
{
|
||||||
// Doublon
|
// Doublon
|
||||||
$this->error = $langs->trans("ErrorDuplicateField");
|
$this->error = $langs->trans("ErrorDuplicateField");
|
||||||
$result = -1;
|
$result = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = -2;
|
$this->error = $this->db->lasterror();
|
||||||
|
$result = -2;
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -21,10 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/societe/price.php
|
* \file htdocs/societe/price.php
|
||||||
* \ingroup product
|
* \ingroup product
|
||||||
* \brief Page to show product prices by customer
|
* \brief Page to show product prices by customer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
@@ -42,7 +43,8 @@ $langs->load("companies");
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$search_prod = GETPOST('search_prod');
|
$search_prod = GETPOST('search_prod','alpha');
|
||||||
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
|
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
|
||||||
@@ -71,36 +73,72 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$search_prod = '';
|
$search_prod = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
if ($action == 'add_customer_price_confirm' && ! $cancel && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
|
|
||||||
$update_child_soc = GETPOST('updatechildprice');
|
$update_child_soc = GETPOST('updatechildprice');
|
||||||
|
|
||||||
// add price by customer
|
// add price by customer
|
||||||
$prodcustprice->fk_soc = $socid;
|
$prodcustprice->fk_soc = $socid;
|
||||||
$prodcustprice->fk_product = GETPOST('prodid', 'int');
|
$prodcustprice->fk_product = GETPOST('prodid', 'int');
|
||||||
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
|
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
|
||||||
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
|
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
|
||||||
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
||||||
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
|
|
||||||
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
|
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
|
||||||
|
|
||||||
|
// We must define tva_tx, npr and local taxes
|
||||||
|
$vatratecode = '';
|
||||||
|
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||||
|
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||||
|
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
|
||||||
|
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
|
||||||
|
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
|
||||||
|
{
|
||||||
|
// We look into database using code (we can't use get_localtax() because it depends on buyer that is not known). Same in update price.
|
||||||
|
$vatratecode=$reg[1];
|
||||||
|
// Get record from code
|
||||||
|
$sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||||
|
$sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'";
|
||||||
|
$sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||||
|
$sql.= " AND t.code ='".$vatratecode."'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$npr = $obj->recuperableonly;
|
||||||
|
$localtax1 = $obj->localtax1;
|
||||||
|
$localtax2 = $obj->localtax2;
|
||||||
|
$localtax1_type = $obj->localtax1_type;
|
||||||
|
$localtax2_type = $obj->localtax2_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$prodcustprice->default_vat_code = $vatratecode;
|
||||||
|
$prodcustprice->tva_tx = $tva_tx;
|
||||||
|
$prodcustprice->recuperableonly = $npr;
|
||||||
|
$prodcustprice->localtax1_tx = $localtax1;
|
||||||
|
$prodcustprice->localtax2_tx = $localtax2;
|
||||||
|
$prodcustprice->localtax1_type = $localtax1_type;
|
||||||
|
$prodcustprice->localtax2_type = $localtax2_type;
|
||||||
|
|
||||||
$result = $prodcustprice->create($user, 0, $update_child_soc);
|
$result = $prodcustprice->create($user, 0, $update_child_soc);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
// Delete price by customer
|
// Delete price by customer
|
||||||
$prodcustprice->id = GETPOST('lineid');
|
$prodcustprice->id = GETPOST('lineid');
|
||||||
$result = $prodcustprice->delete($user);
|
$result = $prodcustprice->delete($user);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
@@ -108,27 +146,27 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
|
|
||||||
$prodcustprice->fetch(GETPOST('lineid', 'int'));
|
$prodcustprice->fetch(GETPOST('lineid', 'int'));
|
||||||
|
|
||||||
$update_child_soc = GETPOST('updatechildprice');
|
$update_child_soc = GETPOST('updatechildprice');
|
||||||
|
|
||||||
// update price by customer
|
// update price by customer
|
||||||
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
|
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
|
||||||
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
|
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
|
||||||
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
||||||
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
|
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
|
||||||
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
|
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
|
||||||
|
|
||||||
$result = $prodcustprice->update($user, 0, $update_child_soc);
|
$result = $prodcustprice->update($user, 0, $update_child_soc);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,7 +192,7 @@ dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company');
|
|||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
|
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
@@ -239,7 +277,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||||
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
|
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, '', false, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Price base
|
// Price base
|
||||||
@@ -299,7 +337,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print load_fiche_titre($langs->trans('PriceByCustomer'));
|
print load_fiche_titre($langs->trans('PriceByCustomer'));
|
||||||
|
|
||||||
$result = $prodcustprice->fetch(GETPOST('lineid', 'int'));
|
$result = $prodcustprice->fetch(GETPOST('lineid', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
}
|
}
|
||||||
@@ -374,6 +412,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '<br></form>';
|
print '<br></form>';
|
||||||
} elseif ($action == 'showlog_customer_price') {
|
} elseif ($action == 'showlog_customer_price') {
|
||||||
|
|
||||||
|
print '<!-- showlog_customer_price -->'."\n";
|
||||||
|
|
||||||
$filter = array (
|
$filter = array (
|
||||||
't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid
|
't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid
|
||||||
);
|
);
|
||||||
@@ -385,7 +425,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
$result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
}
|
}
|
||||||
@@ -440,8 +480,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans('None');
|
print $langs->trans('None');
|
||||||
}
|
}
|
||||||
@@ -449,8 +489,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print "\n" . '<div class="tabsAction">' . "\n";
|
print "\n" . '<div class="tabsAction">' . "\n";
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '">' . $langs->trans("Ok") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '">' . $langs->trans("Ok") . '</a></div>';
|
||||||
print "\n</div><br>\n";
|
print "\n</div><br>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// View mode
|
// View mode
|
||||||
|
|
||||||
@@ -466,30 +506,32 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&socid=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&socid=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||||
}
|
}
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
$option = '&search_prod=' . $search_prod . '&id=' . $object->id;
|
$option = '&search_prod=' . $search_prod . '&id=' . $object->id;
|
||||||
|
|
||||||
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
|
print '<!-- view specific price for each product -->'."\n";
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans("Product") . '</td>';
|
print '<td>' . $langs->trans("Product") . '</td>';
|
||||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||||
@@ -502,12 +544,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (count($prodcustprice->lines) > 0 || $search_prod)
|
if (count($prodcustprice->lines) > 0 || $search_prod)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td><input type="text" class="flat" name="search_prod" value="' . $search_prod . '" size="20"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" name="search_prod" value="' . $search_prod . '" size="20"></td>';
|
||||||
print '<td colspan="8"> </td>';
|
print '<td class="liste_titre" colspan="8"> </td>';
|
||||||
// Print the search button
|
// Print the search button
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
@@ -515,35 +557,35 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($prodcustprice->lines) > 0)
|
if (count($prodcustprice->lines) > 0)
|
||||||
{
|
{
|
||||||
$var = False;
|
$var = False;
|
||||||
|
|
||||||
foreach ($prodcustprice->lines as $line)
|
foreach ($prodcustprice->lines as $line)
|
||||||
{
|
{
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
|
|
||||||
$staticprod = new Product($db);
|
$staticprod = new Product($db);
|
||||||
$staticprod->fetch($line->fk_product);
|
$staticprod->fetch($line->fk_product);
|
||||||
|
|
||||||
print "<td>" . $staticprod->getNomUrl(1) . "</td>";
|
print "<td>" . $staticprod->getNomUrl(1) . "</td>";
|
||||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||||
|
|
||||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||||
print '<td align="right">' . vatrate($line->tva_tx, true, $line->recuperableonly) . "</td>";
|
print '<td align="right">' . vatrate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), true, $line->recuperableonly) . "</td>";
|
||||||
print '<td align="right">' . price($line->price) . "</td>";
|
print '<td align="right">' . price($line->price) . "</td>";
|
||||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||||
print '<td align="right">' . price($line->price_min) . '</td>';
|
print '<td align="right">' . price($line->price_min) . '</td>';
|
||||||
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
||||||
|
|
||||||
// User
|
// User
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
$userstatic->fetch($line->fk_user);
|
$userstatic->fetch($line->fk_user);
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Action
|
// Action
|
||||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||||
{
|
{
|
||||||
@@ -561,21 +603,21 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$colspan=9;
|
$colspan=9;
|
||||||
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1;
|
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1;
|
||||||
print '<tr ' . $bc[false] . '><td colspan="'.$colspan.'">' . $langs->trans('None') . '</td></tr>';
|
print '<tr ' . $bc[false] . '><td colspan="'.$colspan.'">' . $langs->trans('None') . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ class SupplierProposal extends CommonObject
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la propale meme
|
// Mise a jour informations denormalisees au niveau de la propale meme
|
||||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$this->thirdparty); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@@ -132,21 +132,21 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
/*$tmp=dol_buildpath('/google/oauth2callback.php', 0);
|
/*$tmp=dol_buildpath('/google/oauth2callback.php', 0);
|
||||||
var_dump($tmp);
|
var_dump($tmp);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*$tmp=dol_buildpath('/google/oauth2callback.php', 1);
|
/*$tmp=dol_buildpath('/google/oauth2callback.php', 1);
|
||||||
var_dump($tmp);
|
var_dump($tmp);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$result=dol_buildpath('/google/oauth2callback.php', 2);
|
$result=dol_buildpath('/google/oauth2callback.php', 2);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertStringStartsWith('http', $result);
|
$this->assertStringStartsWith('http', $result);
|
||||||
|
|
||||||
$result=dol_buildpath('/google/oauth2callback.php', 3);
|
$result=dol_buildpath('/google/oauth2callback.php', 3);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertStringStartsWith('http', $result);
|
$this->assertStringStartsWith('http', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testGetBrowserInfo
|
* testGetBrowserInfo
|
||||||
*
|
*
|
||||||
@@ -512,32 +512,48 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
// Default trunc (will add ... if truncation truncation or keep last char if only one char)
|
// Default trunc (will add ... if truncation truncation or keep last char if only one char)
|
||||||
$input="éeéeéeàa";
|
$input="éeéeéeàa";
|
||||||
$after=dol_trunc($input,3);
|
$after=dol_trunc($input,3);
|
||||||
$this->assertEquals("éeé...",$after);
|
$this->assertEquals("éeé...",$after,'Test A1');
|
||||||
$after=dol_trunc($input,2);
|
$after=dol_trunc($input,2);
|
||||||
$this->assertEquals("ée...",$after);
|
$this->assertEquals("ée...",$after,'Test A2');
|
||||||
|
$after=dol_trunc($input,1);
|
||||||
|
$this->assertEquals("é...",$after,'Test A3');
|
||||||
|
$input="éeéeé";
|
||||||
|
$after=dol_trunc($input,3);
|
||||||
|
$this->assertEquals("éeéeé",$after,'Test B1');
|
||||||
|
$after=dol_trunc($input,2);
|
||||||
|
$this->assertEquals("éeéeé",$after,'Test B2');
|
||||||
|
$after=dol_trunc($input,1);
|
||||||
|
$this->assertEquals("é...",$after,'Test B3');
|
||||||
|
$input="éeée";
|
||||||
|
$after=dol_trunc($input,3);
|
||||||
|
$this->assertEquals("éeée",$after,'Test C1');
|
||||||
|
$after=dol_trunc($input,2);
|
||||||
|
$this->assertEquals("éeée",$after,'Test C2');
|
||||||
|
$after=dol_trunc($input,1);
|
||||||
|
$this->assertEquals("éeée",$after,'Test C3');
|
||||||
$input="éeé";
|
$input="éeé";
|
||||||
$after=dol_trunc($input,3);
|
$after=dol_trunc($input,3);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test C');
|
||||||
$after=dol_trunc($input,2);
|
$after=dol_trunc($input,2);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test D');
|
||||||
$after=dol_trunc($input,1);
|
$after=dol_trunc($input,1);
|
||||||
$this->assertEquals("é...",$after);
|
$this->assertEquals("éeé",$after,'Test E');
|
||||||
// Trunc with no ...
|
// Trunc with no ...
|
||||||
$input="éeéeéeàa";
|
$input="éeéeéeàa";
|
||||||
$after=dol_trunc($input,3,'right','UTF-8',1);
|
$after=dol_trunc($input,3,'right','UTF-8',1);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test F');
|
||||||
$after=dol_trunc($input,2,'right','UTF-8',1);
|
$after=dol_trunc($input,2,'right','UTF-8',1);
|
||||||
$this->assertEquals("ée",$after);
|
$this->assertEquals("ée",$after,'Test G');
|
||||||
$input="éeé";
|
$input="éeé";
|
||||||
$after=dol_trunc($input,3,'right','UTF-8',1);
|
$after=dol_trunc($input,3,'right','UTF-8',1);
|
||||||
$this->assertEquals("éeé",$after);
|
$this->assertEquals("éeé",$after,'Test H');
|
||||||
$after=dol_trunc($input,2,'right','UTF-8',1);
|
$after=dol_trunc($input,2,'right','UTF-8',1);
|
||||||
$this->assertEquals("ée",$after);
|
$this->assertEquals("ée",$after,'Test I');
|
||||||
$after=dol_trunc($input,1,'right','UTF-8',1);
|
$after=dol_trunc($input,1,'right','UTF-8',1);
|
||||||
$this->assertEquals("é",$after);
|
$this->assertEquals("é",$after,'Test J');
|
||||||
$input="éeéeéeàa";
|
$input="éeéeéeàa";
|
||||||
$after=dol_trunc($input,4,'middle');
|
$after=dol_trunc($input,4,'middle');
|
||||||
$this->assertEquals("ée...àa",$after);
|
$this->assertEquals("ée...àa",$after,'Test K');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -668,7 +684,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals("21 jump street\nMyTown, MyState, 99999",$address);
|
$this->assertEquals("21 jump street\nMyTown, MyState, 99999",$address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDolFormatAddress
|
* testDolFormatAddress
|
||||||
*
|
*
|
||||||
@@ -681,18 +697,18 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$user=$this->savuser;
|
$user=$this->savuser;
|
||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
$object=new Societe($db);
|
$object=new Societe($db);
|
||||||
$object->initAsSpecimen();
|
$object->initAsSpecimen();
|
||||||
|
|
||||||
$object->country_code='FR';
|
$object->country_code='FR';
|
||||||
$phone=dol_print_phone('1234567890', $object->country_code);
|
$phone=dol_print_phone('1234567890', $object->country_code);
|
||||||
$this->assertEquals('<span style="margin-right: 10px;">12 34 56 78 90</span>', $phone, 'Phone for FR 1');
|
$this->assertEquals('<span style="margin-right: 10px;">12 34 56 78 90</span>', $phone, 'Phone for FR 1');
|
||||||
|
|
||||||
$object->country_code='FR';
|
$object->country_code='FR';
|
||||||
$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, '');
|
$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, '');
|
||||||
$this->assertEquals('<span style="margin-right: 10px;">1234567890</span>', $phone, 'Phone for FR 2');
|
$this->assertEquals('<span style="margin-right: 10px;">1234567890</span>', $phone, 'Phone for FR 2');
|
||||||
|
|
||||||
$object->country_code='FR';
|
$object->country_code='FR';
|
||||||
$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
|
$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
|
||||||
$this->assertEquals('<span style="margin-right: 10px;">12 34 56 78 90</span>', $phone, 'Phone for FR 3');
|
$this->assertEquals('<span style="margin-right: 10px;">12 34 56 78 90</span>', $phone, 'Phone for FR 3');
|
||||||
@@ -700,10 +716,10 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$object->country_code='CA';
|
$object->country_code='CA';
|
||||||
$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
|
$phone=dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
|
||||||
$this->assertEquals('<span style="margin-right: 10px;">(123) 456-7890</span>', $phone, 'Phone for CA 1');
|
$this->assertEquals('<span style="margin-right: 10px;">(123) 456-7890</span>', $phone, 'Phone for CA 1');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testImgPicto
|
* testImgPicto
|
||||||
*
|
*
|
||||||
@@ -1053,5 +1069,5 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user