New: Add custom code and origin country into invoice
This commit is contained in:
parent
a7992ef436
commit
d79adf6090
@ -171,16 +171,19 @@ function societe_prepare_head2($objsoc)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return country translated from an id or a code
|
* Return country translated from an id or a code
|
||||||
* @param id id or code of country
|
* @param id Id or code of country
|
||||||
* @param withcode 0=Return label, 1=Return code + label, 2=Return code from id
|
* @param withcode 0=Return label, 1=Return code + label, 2=Return code from id
|
||||||
* @param dbtouse Database handler (using in global way may fail because of conflicts with some autoload features)
|
* @param dbtouse Database handler (using in global way may fail because of conflicts with some autoload features)
|
||||||
|
* @param outputlangs Lang object for output translation
|
||||||
|
* @param entconv 0=Return value without entities and not converted to output charset
|
||||||
* @return string String with country code or translated country name
|
* @return string String with country code or translated country name
|
||||||
*/
|
*/
|
||||||
function getCountry($id,$withcode=0,$dbtouse=0)
|
function getCountry($id,$withcode=0,$dbtouse=0,$outputlangs='',$entconv=1)
|
||||||
{
|
{
|
||||||
global $db,$langs;
|
global $db,$langs;
|
||||||
|
|
||||||
if (! is_object($dbtouse)) $dbtouse=$db;
|
if (! is_object($dbtouse)) $dbtouse=$db;
|
||||||
|
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||||
|
|
||||||
$sql = "SELECT rowid, code, libelle FROM ".MAIN_DB_PREFIX."c_pays";
|
$sql = "SELECT rowid, code, libelle FROM ".MAIN_DB_PREFIX."c_pays";
|
||||||
if (is_numeric($id)) $sql.= " WHERE rowid=".$id;
|
if (is_numeric($id)) $sql.= " WHERE rowid=".$id;
|
||||||
@ -194,10 +197,11 @@ function getCountry($id,$withcode=0,$dbtouse=0)
|
|||||||
if ($obj)
|
if ($obj)
|
||||||
{
|
{
|
||||||
$label=((! empty($obj->libelle) && $obj->libelle!='-')?$obj->libelle:'');
|
$label=((! empty($obj->libelle) && $obj->libelle!='-')?$obj->libelle:'');
|
||||||
if (is_object($langs))
|
if (is_object($outputlangs))
|
||||||
{
|
{
|
||||||
$langs->load("dict");
|
$outputlangs->load("dict");
|
||||||
$label=($obj->code && ($langs->trans("Country".$obj->code)!="Country".$obj->code))?$langs->trans("Country".$obj->code):$label;
|
if ($entconv) $label=($obj->code && ($outputlangs->trans("Country".$obj->code)!="Country".$obj->code))?$outputlangs->trans("Country".$obj->code):$label;
|
||||||
|
else $label=($obj->code && ($outputlangs->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code))?$outputlangs->transnoentitiesnoconv("Country".$obj->code):$label;
|
||||||
}
|
}
|
||||||
if ($withcode == 1) return $label?"$obj->code - $label":"$obj->code";
|
if ($withcode == 1) return $label?"$obj->code - $label":"$obj->code";
|
||||||
else if ($withcode == 2) return $obj->code;
|
else if ($withcode == 2) return $obj->code;
|
||||||
|
|||||||
@ -634,6 +634,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note that we used here current custom and origin country code.
|
// Note that we used here current custom and origin country code.
|
||||||
|
/* Fix, this must be done when saving line
|
||||||
if (! empty($prodser->customcode) || ! empty($prodser->country_code))
|
if (! empty($prodser->customcode) || ! empty($prodser->country_code))
|
||||||
{
|
{
|
||||||
//var_dump($prodser);exit;
|
//var_dump($prodser);exit;
|
||||||
@ -643,7 +644,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
if (! empty($prodser->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prodser->country_code,0,$db,$outputlangs,0);
|
if (! empty($prodser->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prodser->country_code,0,$db,$outputlangs,0);
|
||||||
$tmptxt.=')';
|
$tmptxt.=')';
|
||||||
$libelleproduitservice.="<br>".$tmptxt;
|
$libelleproduitservice.="<br>".$tmptxt;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return $libelleproduitservice;
|
return $libelleproduitservice;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user