Skip to content

Commit

Permalink
Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 16, 2015
2 parents bc4ecf8 + 60c72e1 commit 04c88b0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
32 changes: 24 additions & 8 deletions htdocs/exports/class/export.class.php
Expand Up @@ -337,13 +337,15 @@ function conditionDate($Field, $Value, $Sens)
/**
* Build an input field used to filter the query
*
* @param string $TypeField Type of Field to filter
* @param string $TypeField Type of Field to filter. Example: Text, List:c_country:label:rowid, List:c_stcom:label:code, Number, Boolean
* @param string $NameField Name of the field to filter
* @param string $ValueField Initial value of the field to filter
* @return string html string of the input field ex : "<input type=text name=... value=...>"
*/
function build_filterField($TypeField, $NameField, $ValueField)
{
global $langs;

$szFilterField='';
$InfoFieldList = explode(":", $TypeField);

Expand All @@ -354,7 +356,7 @@ function build_filterField($TypeField, $NameField, $ValueField)
case 'Date':
case 'Duree':
case 'Numeric':
$szFilterField='<input type="text" name='.$NameField." value='".$ValueField."'>";
$szFilterField='<input type="text" name="'.$NameField.'" value="'.$ValueField.'">';
break;
case 'Boolean':
$szFilterField='<select name="'.$NameField.'" class="flat">';
Expand All @@ -375,12 +377,14 @@ function build_filterField($TypeField, $NameField, $ValueField)
// 0 : Type du champ
// 1 : Nom de la table
// 2 : Nom du champ contenant le libelle
// 3 : Nom du champ contenant la cle (si different de rowid)
// 3 : Name of field with key (if it is not "rowid"). Used this field as key for combo list.
if (count($InfoFieldList)==4)
$keyList=$InfoFieldList[3];
else
$keyList='rowid';
$sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2];
$sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3])?'':', '.$InfoFieldList[3].' as code');
if ($InfoFieldList[1] == 'c_stcomm') $sql = 'SELECT id as id, '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3])?'':', '.$InfoFieldList[3].' as code');
if ($InfoFieldList[1] == 'c_country') $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label, code as code';
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[1];

$resql = $this->db->query($sql);
Expand All @@ -396,14 +400,25 @@ function build_filterField($TypeField, $NameField, $ValueField)
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($obj->$InfoFieldList[2] == '-')
if ($obj->label == '-')
{
// Discard entry '-'
$i++;
continue;
}

$labeltoshow=dol_trunc($obj->$InfoFieldList[2],18);
//var_dump($InfoFieldList[1]);
$labeltoshow=dol_trunc($obj->label,18);
if ($InfoFieldList[1] == 'c_stcomm')
{
$langs->load("companies");
$labeltoshow=(($langs->trans("StatusProspect".$obj->id) != "StatusProspect".$obj->id)?$langs->trans("StatusProspect".$obj->id):$obj->label);
}
if ($InfoFieldList[1] == 'c_country')
{
//var_dump($sql);
$langs->load("dict");
$labeltoshow=(($langs->trans("Country".$obj->code) != "Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label);
}
if (!empty($ValueField) && $ValueField == $obj->rowid)
{
$szFilterField.='<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
Expand All @@ -417,8 +432,9 @@ function build_filterField($TypeField, $NameField, $ValueField)
}
$szFilterField.="</select>";

$this->db->free();
$this->db->free($resql);
}
else dol_print_error($this->db);
break;
}

Expand Down
10 changes: 5 additions & 5 deletions htdocs/install/mysql/data/llx_c_stcomm.sql
Expand Up @@ -31,8 +31,8 @@
--

delete from llx_c_stcomm;
insert into llx_c_stcomm (id,code,libelle) values (-1, 'ST_NO', 'Ne pas contacter');
insert into llx_c_stcomm (id,code,libelle) values ( 0, 'ST_NEVER', 'Jamais contacté');
insert into llx_c_stcomm (id,code,libelle) values ( 1, 'ST_TODO', 'A contacter');
insert into llx_c_stcomm (id,code,libelle) values ( 2, 'ST_PEND', 'Contact en cours');
insert into llx_c_stcomm (id,code,libelle) values ( 3, 'ST_DONE', 'Contactée');
insert into llx_c_stcomm (id,code,libelle) values (-1, 'ST_NO', 'Do not contact');
insert into llx_c_stcomm (id,code,libelle) values ( 0, 'ST_NEVER', 'Never contacted');
insert into llx_c_stcomm (id,code,libelle) values ( 1, 'ST_TODO', 'To contact');
insert into llx_c_stcomm (id,code,libelle) values ( 2, 'ST_PEND', 'Contact in progress');
insert into llx_c_stcomm (id,code,libelle) values ( 3, 'ST_DONE', 'Contacted');
5 changes: 3 additions & 2 deletions htdocs/langs/en_US/bills.lang
Expand Up @@ -74,8 +74,9 @@ PaymentsAlreadyDone=Payments already done
PaymentsBackAlreadyDone=Payments back already done
PaymentRule=Payment rule
PaymentMode=Payment type
PaymentConditions=Payment term
PaymentConditionsShort=Payment term
PaymentTerm=Payment term
PaymentConditions=Payment terms
PaymentConditionsShort=Payment terms
PaymentAmount=Payment amount
ValidatePayment=Validate payment
PaymentHigherThanReminderToPay=Payment higher than reminder to pay
Expand Down

0 comments on commit 04c88b0

Please sign in to comment.