89 |
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent"; |
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent"; |
90 |
$tabsql[9] = "SELECT code as rowid, code, code_iso, label as libelle, active FROM ".MAIN_DB_PREFIX."c_currencies"; |
$tabsql[9] = "SELECT code as rowid, code, code_iso, label as libelle, active FROM ".MAIN_DB_PREFIX."c_currencies"; |
91 |
$tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, t.recuperableonly, t.note, t.active FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; |
$tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, t.recuperableonly, t.note, t.active FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; |
92 |
$tabsql[11]= "SELECT t.rowid as rowid, code, element, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; |
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; |
93 |
|
|
94 |
// Tri par defaut |
// Tri par defaut |
95 |
$tabsqlsort[1] ="pays, code ASC"; |
$tabsqlsort[1] ="pays, code ASC"; |
102 |
$tabsqlsort[8] ="libelle ASC"; |
$tabsqlsort[8] ="libelle ASC"; |
103 |
$tabsqlsort[9] ="code ASC"; |
$tabsqlsort[9] ="code ASC"; |
104 |
$tabsqlsort[10]="pays ASC, taux ASC, recuperableonly ASC"; |
$tabsqlsort[10]="pays ASC, taux ASC, recuperableonly ASC"; |
105 |
$tabsqlsort[11]="element ASC, code ASC, libelle ASC"; |
$tabsqlsort[11]="element ASC, source ASC, code ASC"; |
106 |
|
|
107 |
// Nom des champs en resultat de select pour affichage du dictionnaire |
// Nom des champs en resultat de select pour affichage du dictionnaire |
108 |
$tabfield[1] = "code,libelle,pays"; |
$tabfield[1] = "code,libelle,pays"; |
115 |
$tabfield[8] = "code,libelle"; |
$tabfield[8] = "code,libelle"; |
116 |
$tabfield[9] = "code,code_iso,libelle"; |
$tabfield[9] = "code,code_iso,libelle"; |
117 |
$tabfield[10]= "pays,taux,recuperableonly,note"; |
$tabfield[10]= "pays,taux,recuperableonly,note"; |
118 |
$tabfield[11]= "element,code,libelle"; |
$tabfield[11]= "element,source,code,libelle"; |
119 |
|
|
120 |
// Nom des champs dans la table pour insertion d'un enregistrement |
// Nom des champs dans la table pour insertion d'un enregistrement |
121 |
$tabfieldinsert[1] = "code,libelle,fk_pays"; |
$tabfieldinsert[1] = "code,libelle,fk_pays"; |
128 |
$tabfieldinsert[8] = "code,libelle"; |
$tabfieldinsert[8] = "code,libelle"; |
129 |
$tabfieldinsert[9] = "code,code_iso,libelle"; |
$tabfieldinsert[9] = "code,code_iso,libelle"; |
130 |
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,note"; |
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,note"; |
131 |
$tabfieldinsert[11]= "element,code,libelle"; |
$tabfieldinsert[11]= "element,source,code,libelle"; |
132 |
|
|
133 |
// Nom du rowid si le champ n'est pas de type autoincrément |
// Nom du rowid si le champ n'est pas de type autoincrément |
134 |
$tabrowid[1] = ""; |
$tabrowid[1] = ""; |
210 |
$result = $db->query($sql); |
$result = $db->query($sql); |
211 |
if (!$result) |
if (!$result) |
212 |
{ |
{ |
213 |
if ($db->errno() == DB_ERROR_RECORD_ALREADY_EXISTS) { |
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
214 |
$msg=$langs->trans("ErrorRecordAlreadyExists").'<br>'; |
$msg=$langs->trans("ErrorRecordAlreadyExists").'<br>'; |
215 |
} |
} |
216 |
else { |
else { |
334 |
// Determine le nom du champ par rapport aux noms possibles |
// Determine le nom du champ par rapport aux noms possibles |
335 |
// dans les dictionnaires de données |
// dans les dictionnaires de données |
336 |
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut |
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut |
337 |
|
if ($fieldlist[$field]=='source') $valuetoshow=$langs->trans("Contact"); |
338 |
if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language"); |
if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language"); |
339 |
if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type"); |
if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type"); |
340 |
if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code"); |
if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code"); |
370 |
$html->select_lang(MAIN_LANG_DEFAULT,'lang'); |
$html->select_lang(MAIN_LANG_DEFAULT,'lang'); |
371 |
print '</td>'; |
print '</td>'; |
372 |
} |
} |
373 |
// le type de l'element (pour les type de contact).' |
// Le type de l'element (pour les type de contact).' |
374 |
elseif ($fieldlist[$field] == 'element') { |
elseif ($fieldlist[$field] == 'element') |
375 |
|
{ |
376 |
|
$langs->load("orders"); |
377 |
|
$langs->load("contracts"); |
378 |
|
$langs->load("project"); |
379 |
|
$langs->load("propal"); |
380 |
|
$langs->load("bills"); |
381 |
print '<td>'; |
print '<td>'; |
382 |
$elementList = array(); |
$elementList = array("commande"=>$langs->trans("Order"), |
383 |
// un peu crad mais je n'ai pas de meilleure idee. |
"contrat"=>$langs->trans("Contract"), |
384 |
$elementList["contrat"] = "contrat"; |
"projet"=>$langs->trans("Project"), |
385 |
$elementList["projet"] = "projet"; |
"propal"=>$langs->trans("Propal"), |
386 |
$elementList["propal"] = "propal"; |
"facture"=>$langs->trans("Bill")); |
|
$elementList["facture"] = "facture"; |
|
|
|
|
387 |
$html->select_array('element', $elementList); |
$html->select_array('element', $elementList); |
388 |
print '</td>'; |
print '</td>'; |
389 |
} |
} |
390 |
|
// La source de l'element (pour les type de contact).' |
391 |
|
elseif ($fieldlist[$field] == 'source') { |
392 |
|
print '<td>'; |
393 |
|
$elementList = array("internal"=>$langs->trans("Internal"), |
394 |
|
"external"=>$langs->trans("External")); |
395 |
|
$html->select_array('source', $elementList); |
396 |
|
print '</td>'; |
397 |
|
} |
398 |
elseif ($fieldlist[$field] == 'type') { |
elseif ($fieldlist[$field] == 'type') { |
399 |
print '<td>'; |
print '<td>'; |
400 |
print 'user<input type="hidden" name="type" value="user">'; |
print 'user<input type="hidden" name="type" value="user">'; |
435 |
// Determine le nom du champ par rapport aux noms possibles |
// Determine le nom du champ par rapport aux noms possibles |
436 |
// dans les dictionnaires de données |
// dans les dictionnaires de données |
437 |
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut |
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut |
438 |
if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language"); |
if ($fieldlist[$field]=='source') $valuetoshow=$langs->trans("Contact"); |
439 |
if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type"); |
if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language"); |
440 |
if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code"); |
if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type"); |
441 |
if ($fieldlist[$field]=='libelle') $valuetoshow=$langs->trans("Label")."*"; |
if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code"); |
442 |
if ($fieldlist[$field]=='pays') $valuetoshow=$langs->trans("Country"); |
if ($fieldlist[$field]=='libelle') $valuetoshow=$langs->trans("Label")."*"; |
443 |
|
if ($fieldlist[$field]=='pays') $valuetoshow=$langs->trans("Country"); |
444 |
if ($fieldlist[$field]=='recuperableonly') $valuetoshow=$langs->trans("VATReceivedOnly"); |
if ($fieldlist[$field]=='recuperableonly') $valuetoshow=$langs->trans("VATReceivedOnly"); |
445 |
// Affiche nom du champ |
// Affiche nom du champ |
446 |
print_liste_field_titre($valuetoshow,"dict.php",$fieldlist[$field],"&id=".$_GET["id"],"","",$sortfield); |
print_liste_field_titre($valuetoshow,"dict.php",$fieldlist[$field],"&id=".$_GET["id"],"","",$sortfield); |