Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7

This commit is contained in:
Laurent Destailleur 2015-03-16 18:26:07 +01:00
commit 04c88b0d94
3 changed files with 32 additions and 15 deletions

View File

@ -337,13 +337,15 @@ class Export
/** /**
* Build an input field used to filter the query * 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 $NameField Name of the field to filter
* @param string $ValueField Initial value 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=...>" * @return string html string of the input field ex : "<input type=text name=... value=...>"
*/ */
function build_filterField($TypeField, $NameField, $ValueField) function build_filterField($TypeField, $NameField, $ValueField)
{ {
global $langs;
$szFilterField=''; $szFilterField='';
$InfoFieldList = explode(":", $TypeField); $InfoFieldList = explode(":", $TypeField);
@ -354,7 +356,7 @@ class Export
case 'Date': case 'Date':
case 'Duree': case 'Duree':
case 'Numeric': case 'Numeric':
$szFilterField='<input type="text" name='.$NameField." value='".$ValueField."'>"; $szFilterField='<input type="text" name="'.$NameField.'" value="'.$ValueField.'">';
break; break;
case 'Boolean': case 'Boolean':
$szFilterField='<select name="'.$NameField.'" class="flat">'; $szFilterField='<select name="'.$NameField.'" class="flat">';
@ -375,12 +377,14 @@ class Export
// 0 : Type du champ // 0 : Type du champ
// 1 : Nom de la table // 1 : Nom de la table
// 2 : Nom du champ contenant le libelle // 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) if (count($InfoFieldList)==4)
$keyList=$InfoFieldList[3]; $keyList=$InfoFieldList[3];
else else
$keyList='rowid'; $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]; $sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[1];
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -396,14 +400,25 @@ class Export
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj->$InfoFieldList[2] == '-') if ($obj->label == '-')
{ {
// Discard entry '-' // Discard entry '-'
$i++; $i++;
continue; continue;
} }
//var_dump($InfoFieldList[1]);
$labeltoshow=dol_trunc($obj->$InfoFieldList[2],18); $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) if (!empty($ValueField) && $ValueField == $obj->rowid)
{ {
$szFilterField.='<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>'; $szFilterField.='<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
@ -417,8 +432,9 @@ class Export
} }
$szFilterField.="</select>"; $szFilterField.="</select>";
$this->db->free(); $this->db->free($resql);
} }
else dol_print_error($this->db);
break; break;
} }

View File

@ -31,8 +31,8 @@
-- --
delete from llx_c_stcomm; 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 (-1, 'ST_NO', 'Do not contact');
insert into llx_c_stcomm (id,code,libelle) values ( 0, 'ST_NEVER', 'Jamais 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', 'A contacter'); 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 en cours'); 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', 'Contactée'); insert into llx_c_stcomm (id,code,libelle) values ( 3, 'ST_DONE', 'Contacted');

View File

@ -74,8 +74,9 @@ PaymentsAlreadyDone=Payments already done
PaymentsBackAlreadyDone=Payments back already done PaymentsBackAlreadyDone=Payments back already done
PaymentRule=Payment rule PaymentRule=Payment rule
PaymentMode=Payment type PaymentMode=Payment type
PaymentConditions=Payment term PaymentTerm=Payment term
PaymentConditionsShort=Payment term PaymentConditions=Payment terms
PaymentConditionsShort=Payment terms
PaymentAmount=Payment amount PaymentAmount=Payment amount
ValidatePayment=Validate payment ValidatePayment=Validate payment
PaymentHigherThanReminderToPay=Payment higher than reminder to pay PaymentHigherThanReminderToPay=Payment higher than reminder to pay