2
0
forked from Wavyzz/dolibarr

Debug v16

This commit is contained in:
Laurent Destailleur
2022-05-09 11:16:58 +02:00
parent 104b4dcfe5
commit 7c32ac2f42
2 changed files with 218 additions and 242 deletions

View File

@@ -104,50 +104,50 @@ $taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5,
// Name of SQL tables of dictionaries
$tabname = array();
$tabname[1] = MAIN_DB_PREFIX."c_forme_juridique";
$tabname[2] = MAIN_DB_PREFIX."c_departements";
$tabname[3] = MAIN_DB_PREFIX."c_regions";
$tabname[4] = MAIN_DB_PREFIX."c_country";
$tabname[5] = MAIN_DB_PREFIX."c_civility";
$tabname[6] = MAIN_DB_PREFIX."c_actioncomm";
$tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
$tabname[8] = MAIN_DB_PREFIX."c_typent";
$tabname[9] = MAIN_DB_PREFIX."c_currencies";
$tabname[10] = MAIN_DB_PREFIX."c_tva";
$tabname[11] = MAIN_DB_PREFIX."c_type_contact";
$tabname[12] = MAIN_DB_PREFIX."c_payment_term";
$tabname[13] = MAIN_DB_PREFIX."c_paiement";
$tabname[14] = MAIN_DB_PREFIX."c_ecotaxe";
$tabname[15] = MAIN_DB_PREFIX."c_paper_format";
$tabname[16] = MAIN_DB_PREFIX."c_prospectlevel";
$tabname[17] = MAIN_DB_PREFIX."c_type_fees";
$tabname[18] = MAIN_DB_PREFIX."c_shipment_mode";
$tabname[19] = MAIN_DB_PREFIX."c_effectif";
$tabname[20] = MAIN_DB_PREFIX."c_input_method";
$tabname[21] = MAIN_DB_PREFIX."c_availability";
$tabname[22] = MAIN_DB_PREFIX."c_input_reason";
$tabname[23] = MAIN_DB_PREFIX."c_revenuestamp";
$tabname[24] = MAIN_DB_PREFIX."c_type_resource";
$tabname[25] = MAIN_DB_PREFIX."c_type_container";
//$tabname[26]= MAIN_DB_PREFIX."c_units";
$tabname[27] = MAIN_DB_PREFIX."c_stcomm";
$tabname[28] = MAIN_DB_PREFIX."c_holiday_types";
$tabname[29] = MAIN_DB_PREFIX."c_lead_status";
$tabname[30] = MAIN_DB_PREFIX."c_format_cards";
//$tabname[31]= MAIN_DB_PREFIX."accounting_system";
$tabname[32] = MAIN_DB_PREFIX."c_hrm_public_holiday";
$tabname[33] = MAIN_DB_PREFIX."c_hrm_department";
$tabname[34] = MAIN_DB_PREFIX."c_hrm_function";
$tabname[35] = MAIN_DB_PREFIX."c_exp_tax_cat";
$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range";
$tabname[37] = MAIN_DB_PREFIX."c_units";
$tabname[38] = MAIN_DB_PREFIX."c_socialnetworks";
$tabname[39] = MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabname[40] = MAIN_DB_PREFIX."c_stcommcontact";
$tabname[41] = MAIN_DB_PREFIX."c_transport_mode";
$tabname[42] = MAIN_DB_PREFIX."c_product_nature";
$tabname[43] = MAIN_DB_PREFIX."c_productbatch_qcstatus";
$tabname[44] = MAIN_DB_PREFIX."c_asset_disposal_type";
$tabname[1] = "c_forme_juridique";
$tabname[2] = "c_departements";
$tabname[3] = "c_regions";
$tabname[4] = "c_country";
$tabname[5] = "c_civility";
$tabname[6] = "c_actioncomm";
$tabname[7] = "c_chargesociales";
$tabname[8] = "c_typent";
$tabname[9] = "c_currencies";
$tabname[10] = "c_tva";
$tabname[11] = "c_type_contact";
$tabname[12] = "c_payment_term";
$tabname[13] = "c_paiement";
$tabname[14] = "c_ecotaxe";
$tabname[15] = "c_paper_format";
$tabname[16] = "c_prospectlevel";
$tabname[17] = "c_type_fees";
$tabname[18] = "c_shipment_mode";
$tabname[19] = "c_effectif";
$tabname[20] = "c_input_method";
$tabname[21] = "c_availability";
$tabname[22] = "c_input_reason";
$tabname[23] = "c_revenuestamp";
$tabname[24] = "c_type_resource";
$tabname[25] = "c_type_container";
//$tabname[26]= "c_units";
$tabname[27] = "c_stcomm";
$tabname[28] = "c_holiday_types";
$tabname[29] = "c_lead_status";
$tabname[30] = "c_format_cards";
//$tabname[31]= "accounting_system";
$tabname[32] = "c_hrm_public_holiday";
$tabname[33] = "c_hrm_department";
$tabname[34] = "c_hrm_function";
$tabname[35] = "c_exp_tax_cat";
$tabname[36] = "c_exp_tax_range";
$tabname[37] = "c_units";
$tabname[38] = "c_socialnetworks";
$tabname[39] = "c_prospectcontactlevel";
$tabname[40] = "c_stcommcontact";
$tabname[41] = "c_transport_mode";
$tabname[42] = "c_product_nature";
$tabname[43] = "c_productbatch_qcstatus";
$tabname[44] = "c_asset_disposal_type";
// Dictionary labels
$tablib = array();
@@ -265,7 +265,7 @@ $tabsqlsort[17] = "code ASC";
$tabsqlsort[18] = "code ASC, libelle ASC";
$tabsqlsort[19] = "id ASC";
$tabsqlsort[20] = "code ASC, libelle ASC";
$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, qty ASC";
$tabsqlsort[21] = "position ASC, type_duration ASC, qty ASC";
$tabsqlsort[22] = "code ASC, label ASC";
$tabsqlsort[23] = "country ASC, taux ASC";
$tabsqlsort[24] = "code ASC, label ASC";
@@ -528,112 +528,90 @@ $tabcond[42] = !empty($conf->product->enabled);
$tabcond[43] = !empty($conf->product->enabled) && !empty($conf->productbatch->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2;
$tabcond[44] = !empty($conf->asset->enabled);
// List of help for fields
// List of help for fields (no more used, help is defined into tabcomplete)
$tabhelp = array();
$tabhelp[1] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[2] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[3] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[4] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[5] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[6] = array('code'=>$langs->trans("EnterAnyCode"), 'color'=>$langs->trans("ColorFormat"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[7] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[8] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[9] = array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency"));
$tabhelp[10] = array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc"));
$tabhelp[11] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr", $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"), $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset")));
$tabhelp[13] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[14] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[15] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[16] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[17] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[18] = array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"));
$tabhelp[19] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[20] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array('revenuestamp_type'=>$langs->trans('FixedOrPercent'));
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
//$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"), 'dayrule'=>"Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.", 'country'=>$langs->trans("CountryIfSpecificToOneCountry"), 'year'=>$langs->trans("ZeroMeansEveryYear"));
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[35] = array();
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
$tabhelp[41] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[42] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[43] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[44] = array('code'=>$langs->trans("EnterAnyCode"));
// Table to store complete informations (will replace all other table). Key is table name.
$tabcomplete = array(
'c_forme_juridique'=>array('picto'=>'company'),
'c_departements'=>array('picto'=>'state'),
'c_regions'=>array('picto'=>'region'),
'c_country'=>array('picto'=>'country'),
'c_civility'=>array('picto'=>'contact'),
'c_actioncomm'=>array('picto'=>'action'),
'c_chargesociales'=>array('picto'=>'bill'),
'c_typent'=>array('picto'=>'company'),
'c_currencies'=>array('picto'=>'multicurrency'),
'c_tva'=>array('picto'=>'bill'),
'c_type_contact'=>array('picto'=>'contact'),
'c_payment_term'=>array('picto'=>'bill'),
'c_paiement'=>array('picto'=>'bill'),
'c_ecotaxe'=>array('picto'=>'bill'),
'c_paper_format'=>array('picto'=>'generic'),
'c_prospectlevel'=>array('picto'=>'company'),
'c_type_fees'=>array('picto'=>'trip'),
'c_effectif'=>array('picto'=>'company'),
'c_input_method'=>array('picto'=>'order'),
'c_input_reason'=>array('picto'=>'order'),
'c_availability'=>array('picto'=>'shipment'),
'c_shipment_mode'=>array('picto'=>'shipment'),
'c_revenuestamp'=>array('picto'=>'bill'),
'c_type_resource'=>array('picto'=>'resource'),
'c_type_container'=>array('picto'=>'website'),
'c_stcomm'=>array('picto'=>'company'),
'c_holiday_types'=>array('picto'=>'holiday'),
'c_lead_status'=>array('picto'=>'project'),
'c_format_cards'=>array('picto'=>'generic'),
'c_hrm_public_holiday'=>array('picto'=>'holiday'),
'c_hrm_department'=>array('picto'=>'hrm'),
'c_hrm_function'=>array('picto'=>'hrm'),
'c_exp_tax_cat'=>array('picto'=>'expensereport'),
'c_exp_tax_range'=>array('picto'=>'expensereport'),
'c_units'=>array('picto'=>'product'),
'c_socialnetworks'=>array('picto'=>'share-alt'),
'c_product_nature'=>array('picto'=>'product'),
'c_transport_mode'=>array('picto'=>'incoterm'),
'c_prospectcontactlevel'=>array('picto'=>'company'),
'c_stcommcontact'=>array('picto'=>'company'),
'c_product_nature'=>array('picto'=>'product'),
'c_productbatch_qcstatus'=>array('picto'=>'lot'),
'c_asset_disposal_type'=>array('picto'=>'asset'),
'c_forme_juridique'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_departements'=>array('picto'=>'state', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_regions'=>array('picto'=>'region', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_country'=>array('picto'=>'country', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_civility'=>array('picto'=>'contact', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_actioncomm'=>array('picto'=>'action', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'color'=>$langs->trans("ColorFormat"), 'position'=>$langs->trans("PositionIntoComboList"))),
'c_chargesociales'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_typent'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
'c_currencies'=>array('picto'=>'multicurrency', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency"))),
'c_tva'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc"))),
'c_type_contact'=>array('picto'=>'contact', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
'c_payment_term'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr", $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"), $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset")))),
'c_paiement'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_ecotaxe'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_paper_format'=>array('picto'=>'generic', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_prospectlevel'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_type_fees'=>array('picto'=>'trip', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_shipment_mode'=>array('picto'=>'shipment', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"))),
'c_effectif'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_input_method'=>array('picto'=>'order', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_input_reason'=>array('picto'=>'order', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
'c_availability'=>array('picto'=>'shipment', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_revenuestamp'=>array('picto'=>'bill', 'help'=>array('revenuestamp_type'=>$langs->trans('FixedOrPercent'))),
'c_type_resource'=>array('picto'=>'resource', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_type_container'=>array('picto'=>'website', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_stcomm'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"))),
'c_holiday_types'=>array('picto'=>'holiday', 'help'=>array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"))),
'c_lead_status'=>array('picto'=>'project', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"))),
'c_format_cards'=>array('picto'=>'generic', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"))),
'c_hrm_public_holiday'=>array('picto'=>'holiday', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'dayrule'=>"Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.", 'country'=>$langs->trans("CountryIfSpecificToOneCountry"), 'year'=>$langs->trans("ZeroMeansEveryYear"))),
'c_hrm_department'=>array('picto'=>'hrm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_hrm_function'=>array('picto'=>'hrm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_exp_tax_cat'=>array('picto'=>'expensereport', 'help'=>array()),
'c_exp_tax_range'=>array('picto'=>'expensereport', 'help'=>array('range_ik'=>$langs->trans('PrevRangeToThisRange'))),
'c_units'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'))),
'c_socialnetworks'=>array('picto'=>'share-alt', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'))),
'c_prospectcontactlevel'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_stcommcontact'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"))),
'c_transport_mode'=>array('picto'=>'incoterm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_product_nature'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_productbatch_qcstatus'=>array('picto'=>'lot', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_asset_disposal_type'=>array('picto'=>'asset', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
);
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabcomplete);
// Complete the table $tabcomplete
$i = 0;
foreach ($tabcomplete as $key => $value) {
$i++;
$tabcomplete[$key]['id'] = $i;
$tabcomplete[$key]['cond'] = $tabcond[$i];
$tabcomplete[$key]['rowid'] = $tabrowid[$i];
$tabcomplete[$key]['fieldinsert'] = $tabfieldinsert[$i];
$tabcomplete[$key]['fieldvalue'] = $tabfieldvalue[$i];
$tabcomplete[$key]['lib'] = $tablib[$i];
$tabcomplete[$key]['sql'] = $tabsql[$i];
$tabcomplete[$key]['sqlsort'] = $tabsqlsort[$i];
$tabcomplete[$key]['field'] = $tabfield[$i];
}
$keytable = '';
if ($id > 0) {
$arrayofkeys = array_keys($tabcomplete);
$keytable = $arrayofkeys[$id - 1];
}
// Defaut sortorder
if (empty($sortfield)) {
$tmp1 = explode(',', empty($tabsqlsort[$id]) ? '' : $tabsqlsort[$id]);
$tmp1 = explode(',', empty($tabcomplete[$keytable]['sqlsort']) ? '' : $tabcomplete[$keytable]['sqlsort']);
$tmp2 = explode(' ', $tmp1[0]);
$sortfield = preg_replace('/^.*\./', '', $tmp2[0]);
$sortorder = $tmp2[1];
//var_dump($sortfield);var_dump($sortorder);
}
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
$sourceList = array();
@@ -675,8 +653,6 @@ if ($id == 11) {
}
// Define localtax_typeList (used for dictionary "llx_c_tva")
$localtax_typeList = array();
if ($id == 10) {
$localtax_typeList = array(
"0" => $langs->trans("No"),
"1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
@@ -686,14 +662,13 @@ if ($id == 10) {
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
);
}
/*
* Actions
*/
$object = new stdClass();
$parameters = array(
'id' =>$id,
'rowid' =>$rowid,
@@ -824,7 +799,7 @@ if (empty($reshook)) {
}
}
// Other checks
if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) {
if (GETPOST('actionadd') && $tabname[$id] == "c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) {
$ok = 0;
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
@@ -872,7 +847,7 @@ if (empty($reshook)) {
if ($tabrowid[$id]) {
// Get free id for insert
$newid = 0;
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
$sql = "SELECT MAX(".$tabrowid[$id].") as newid FROM ".MAIN_DB_PREFIX.$tabname[$id];
$result = $db->query($sql);
if ($result) {
$obj = $db->fetch_object($result);
@@ -883,7 +858,7 @@ if (empty($reshook)) {
}
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$tabname[$id]." (";
// List of fields
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
$sql .= $tabrowid[$id].",";
@@ -959,7 +934,7 @@ if (empty($reshook)) {
}
// Modify entry
$sql = "UPDATE ".$tabname[$id]." SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET ";
// Modifie valeur des champs
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
$sql .= $tabrowid[$id]."=";
@@ -1014,11 +989,6 @@ if (empty($reshook)) {
setEventMessages($db->error(), null, 'errors');
}
}
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if (GETPOST('actioncancel')) {
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
@@ -1028,7 +998,7 @@ if (empty($reshook)) {
$rowidcol = "rowid";
}
$sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
@@ -1050,9 +1020,9 @@ if (empty($reshook)) {
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
@@ -1070,9 +1040,9 @@ if (empty($reshook)) {
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
@@ -1090,9 +1060,9 @@ if (empty($reshook)) {
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
@@ -1110,9 +1080,9 @@ if (empty($reshook)) {
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
@@ -1130,9 +1100,9 @@ if (empty($reshook)) {
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
@@ -1150,9 +1120,9 @@ if (empty($reshook)) {
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
@@ -1228,7 +1198,7 @@ if ($action == 'delete') {
/*
* Show a dictionary
*/
if ($id) {
if ($id > 0) {
// Complete search values request with sort criteria
$sql = $tabsql[$id];
@@ -1296,6 +1266,7 @@ if ($id) {
print '<table class="noborder centpercent">';
// Line for title
print '<!-- line title to add new entry -->';
$tdsoffields = '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
@@ -1318,7 +1289,7 @@ if ($id) {
$valuetoshow = $langs->trans("PriceUHT");
}
if ($value == 'taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
if ($tabname[$id] != "c_revenuestamp") {
$valuetoshow = $langs->trans("Rate");
} else {
$valuetoshow = $langs->trans("Amount");
@@ -1344,7 +1315,7 @@ if ($id) {
$valuetoshow = $langs->trans("Language");
}
if ($value == 'type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
if ($tabname[$id] == "c_paiement") {
$valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else {
$valuetoshow = $langs->trans("Type");
@@ -1374,12 +1345,14 @@ if ($id) {
}
if ($value == 'nbjour') {
$valuetoshow = $langs->trans("NbOfDays");
$class = 'right';
}
if ($value == 'type_cdr') {
$valuetoshow = $langs->trans("AtEndOfMonth"); $class = "center";
}
if ($value == 'decalage') {
$valuetoshow = $langs->trans("Offset");
$class = 'right';
}
if ($value == 'width' || $value == 'nx') {
$valuetoshow = $langs->trans("Width");
@@ -1416,6 +1389,7 @@ if ($id) {
}
if ($value == 'sortorder') {
$valuetoshow = $langs->trans("SortOrder");
$class = 'center';
}
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
@@ -1512,7 +1486,7 @@ if ($id) {
}
if ($valuetoshow != '') {
$tdsoffields .= '<td'.($class ? ' class="'.$class.'"' : '').'>';
$tdsoffields .= '<th'.($class ? ' class="'.$class.'"' : '').'>';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
$tdsoffields .= '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
@@ -1520,29 +1494,29 @@ if ($id) {
} else {
$tdsoffields .= $valuetoshow;
}
$tdsoffields .= '</td>';
$tdsoffields .= '</th>';
}
}
if ($id == 4) {
$tdsoffields .= '<td></td>';
$tdsoffields .= '<td></td>';
$tdsoffields .= '<th></th>';
$tdsoffields .= '<th></th>';
}
$tdsoffields .= '<td>';
$tdsoffields .= '<th>';
$tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">';
if (!is_null($withentity)) {
$tdsoffields .= '<input type="hidden" name="entity" value="'.$withentity.'">';
}
$tdsoffields .= '</td>';
$tdsoffields .= '<td style="min-width: 26px;"></td>';
$tdsoffields .= '<td style="min-width: 26px;"></td>';
$tdsoffields .= '</th>';
$tdsoffields .= '<th style="min-width: 26px;"></th>';
$tdsoffields .= '<th style="min-width: 26px;"></th>';
$tdsoffields .= '</tr>';
print $tdsoffields;
// Line to enter new values
print '<!-- line to add new entry -->';
print '<!-- line input to add new entry -->';
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass();
@@ -1613,6 +1587,7 @@ if ($id) {
print '<table class="noborder centpercent">';
// Title line with search input fields
print '<!-- line title to search record -->'."\n";
print '<tr class="liste_titre_filter">';
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
@@ -1657,6 +1632,7 @@ if ($id) {
print '</tr>';
// Title of lines
print '<!-- line title of record -->'."\n";
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
@@ -1683,7 +1659,7 @@ if ($id) {
$valuetoshow = $langs->trans("PriceUHT");
}
if ($value == 'taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
if ($tabname[$id] != "c_revenuestamp") {
$valuetoshow = $langs->trans("Rate");
} else {
$valuetoshow = $langs->trans("Amount");
@@ -1736,12 +1712,14 @@ if ($id) {
}
if ($value == 'nbjour') {
$valuetoshow = $langs->trans("NbOfDays");
$cssprefix = 'right ';
}
if ($value == 'type_cdr') {
$valuetoshow = $langs->trans("AtEndOfMonth"); $cssprefix = "center ";
}
if ($value == 'decalage') {
$valuetoshow = $langs->trans("Offset");
$cssprefix = 'right ';
}
if ($value == 'width' || $value == 'nx') {
$valuetoshow = $langs->trans("Width");
@@ -1775,6 +1753,7 @@ if ($id) {
}
if ($value == 'sortorder') {
$valuetoshow = $langs->trans("SortOrder");
$cssprefix = 'center ';
}
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
@@ -1973,58 +1952,58 @@ if ($id) {
$key = $langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$value});
$valuetoshow = nl2br($valuetoshow);
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
} elseif ($value == 'label' && $tabname[$id] == 'c_country') {
$key = $langs->trans("Country".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
} elseif ($value == 'label' && $tabname[$id] == 'c_availability') {
$langs->load("propal");
$key = $langs->trans("AvailabilityType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_actioncomm') {
$key = $langs->trans("Action".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif (!empty($obj->code_iso) && $value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_currencies') {
} elseif (!empty($obj->code_iso) && $value == 'label' && $tabname[$id] == 'c_currencies') {
$key = $langs->trans("Currency".strtoupper($obj->code_iso));
$valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_typent') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_typent') {
$key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_prospectlevel') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_prospectlevel') {
$key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_civility') {
} elseif ($value == 'label' && $tabname[$id] == 'c_civility') {
$key = $langs->trans("Civility".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_contact') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_type_contact') {
$langs->load('agenda');
$key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_payment_term') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_payment_term') {
$langs->load("bills");
$key = $langs->trans("PaymentConditionShort".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_paiement') {
$langs->load("bills");
$key = $langs->trans("PaymentType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'type' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
} elseif ($value == 'type' && $tabname[$id] == 'c_paiement') {
$payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
$valuetoshow = $payment_type_list[$valuetoshow];
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_reason') {
} elseif ($value == 'label' && $tabname[$id] == 'c_input_reason') {
$key = $langs->trans("DemandReasonType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_method') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_input_method') {
$langs->load("orders");
$key = $langs->trans($obj->code);
$valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$value};
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_shipment_mode') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_shipment_mode') {
$langs->load("sendings");
$key = $langs->trans("SendingMethod".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paper_format') {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_paper_format') {
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$value});
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') {
} elseif ($value == 'label' && $tabname[$id] == 'c_type_fees') {
$langs->load('trips');
$key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$value});
@@ -2032,13 +2011,13 @@ if ($id) {
$showfield = 0;
} elseif ($value == 'unicode') {
$valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
} elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == MAIN_DB_PREFIX.'c_units') {
} elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
$langs->load("products");
$valuetoshow = $langs->trans($obj->{$value});
} elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == MAIN_DB_PREFIX.'c_units') {
} elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
$langs->load("products");
$valuetoshow = $langs->trans($obj->{$value});
} elseif (($value == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) {
} elseif (($value == 'unit') && ($tabname[$id] == 'c_paper_format')) {
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$value});
} elseif ($value == 'localtax1' || $value == 'localtax2') {
@@ -2079,20 +2058,20 @@ if ($id) {
}
} elseif ($value == 'fk_c_exp_tax_cat') {
$tmpid = $valuetoshow;
$valuetoshow = getDictionaryValue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $tmpid);
$valuetoshow = getDictionaryValue('c_exp_tax_cat', 'label', $tmpid);
$valuetoshow = $langs->trans($valuetoshow ? $valuetoshow : $tmpid);
} elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat') {
} elseif ($tabname[$id] == 'c_exp_tax_cat') {
$valuetoshow = $langs->trans($valuetoshow);
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_units') {
} elseif ($value == 'label' && $tabname[$id] == 'c_units') {
$langs->load('other');
$key = $langs->trans($obj->label);
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
} elseif ($value == 'code' && $id == 3) {
$valuetoshow = $obj->state_code;
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_product_nature') {
} elseif ($value == 'label' && $tabname[$id] == 'c_product_nature') {
$langs->load("products");
$valuetoshow = $langs->trans($obj->{$value});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_productbatch_qcstatus') {
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == 'c_productbatch_qcstatus') {
$langs->load("productbatch");
$valuetoshow = $langs->trans($obj->{$value});
} elseif ($value == 'block_if_negative') {
@@ -2108,13 +2087,13 @@ if ($id) {
if ($value == 'tracking') {
$class .= ' tdoverflowauto';
}
if (in_array($value, array('pos', 'position', 'deposit_percent'))) {
if (in_array($value, array('nbjour', 'decalage', 'pos', 'position', 'deposit_percent'))) {
$class .= ' right';
}
if (in_array($value, array('localtax1_type', 'localtax2_type'))) {
$class .= ' nowrap';
}
if (in_array($value, array('use_default', 'fk_parent'))) {
if (in_array($value, array('use_default', 'fk_parent', 'sortorder'))) {
$class .= ' center';
}
if ($value == 'public') {
@@ -2158,7 +2137,7 @@ if ($id) {
if (!empty($obj->code) && $obj->code == 'RECEP') {
$canbemodified = 1;
}
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm") {
if ($tabname[$id] == "c_actioncomm") {
$canbemodified = 1;
}
@@ -2185,7 +2164,7 @@ if ($id) {
if ($iserasable) {
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->eec].'_eec&token='.newToken().'">'.$actl[$obj->eec].'</a>';
} else {
print $langs->trans("AlwaysActive");
print '<span class="opacitymedium">'.$langs->trans("AlwaysActive").'</span>';
}
print '</td>';
print '<td class="nowrap center">';
@@ -2193,7 +2172,7 @@ if ($id) {
if ($iserasable) {
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->favorite].'_favorite&token='.newToken().'">'.$actl[$obj->favorite].'</a>';
} else {
print $langs->trans("AlwaysActive");
print '<span class="opacitymedium">'.$langs->trans("AlwaysActive").'</span>';
}
print '</td>';
}
@@ -2210,7 +2189,7 @@ if ($id) {
} elseif (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH') {
print $langs->trans("UsedOnlyWithTypeOption");
} else {
print $langs->trans("AlwaysActive");
print '<span class="opacitymedium">'.$langs->trans("AlwaysActive").'</span>';
}
}
print "</td>";
@@ -2294,7 +2273,7 @@ if ($id) {
print '</a>';
print '</td>';
print '<td class="right">';
print $form->textwithpicto('', $langs->trans("Table").': '.$tabname[$i]);
print $form->textwithpicto('', $langs->trans("Table").': '.MAIN_DB_PREFIX.$tabname[$i]);
print '</td>';
print '</tr>';
$lastlineisempty = false;
@@ -2344,7 +2323,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
continue;
}
if (in_array($value, array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) {
if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) {
$hidden = (!empty($obj->{$value}) ? $obj->{$value}:'');
print '<td>';
print '<input type="hidden" name="'. $value .'" value="'.$hidden.'">';
@@ -2380,15 +2359,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang');
print '</td>';
} elseif ($value == 'element') {
// The type of the element (for contact types)
} elseif (in_array($value, array('element', 'source'))) { //Example: the type and source of the element (for contact types)
print '<td>';
print $form->selectarray('element', $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''));
print '</td>';
} elseif ($value == 'source') {
// The source of the element (for contact types)
print '<td>';
print $form->selectarray('source', $sourceList, (!empty($obj->{$value}) ? $obj->{$value}:''));
print $form->selectarray($value, $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''));
print '</td>';
} elseif (in_array($value, array('public', 'use_default'))) {
// Fields 0/1 with a combo select Yes/No
@@ -2400,12 +2373,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td>';
print $form->selectyesno("private", (!empty($obj->{$value}) ? $obj->{$value}:''));
print '</td>';
} elseif ($value == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") {
} elseif ($value == 'type' && $tabname == "c_actioncomm") {
$type = (!empty($obj->type) ? $obj->type : 'user'); // Check if type is different of 'user' (external module)
print '<td>';
print $type.'<input type="hidden" name="type" value="'.$type.'">';
print '</td>';
} elseif ($value == 'type' && $tabname == MAIN_DB_PREFIX.'c_paiement') {
} elseif ($value == 'type' && $tabname == 'c_paiement') {
print '<td>';
$select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
print $form->selectarray($value, $select_list, (!empty($obj->{$value}) ? $obj->{$value}:'2'));
@@ -2423,7 +2396,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
}
print '</td>';
} elseif (in_array($value, array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
$class = "left";
$class = "right";
if (in_array($value, array('taux', 'localtax1', 'localtax2'))) {
$class = "center"; // Fields aligned on right
}
@@ -2435,7 +2408,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$transfound = 0;
$transkey = '';
// Special case for labels
if ($tabname == MAIN_DB_PREFIX.'c_payment_term') {
if ($tabname == 'c_payment_term') {
$langs->load("bills");
$transkey = "PaymentCondition".strtoupper($obj->code);
if ($langs->trans($transkey) != $transkey) {
@@ -2501,18 +2474,21 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '</td>';
} else {
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';
$classtd = ''; $class = '';
if ($value == 'sortorder') {
$fieldlist[$field] = 'position';
}
$classtd = ''; $class = '';
if ($fieldlist[$field] == 'code') {
$class = 'maxwidth100';
}
if (in_array($fieldlist[$field], array('pos', 'position', 'deposit_percent'))) {
if (in_array($fieldlist[$field], array('deposit_percent'))) {
$classtd = 'right'; $class = 'maxwidth50 right';
}
if (in_array($fieldlist[$field], array('pos', 'position'))) {
$classtd = 'center'; $class = 'maxwidth50 center';
}
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) {
$class = 'maxwidth50 center';
}
@@ -2533,19 +2509,19 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$maxlength = '';
if (in_array($fieldlist[$field], array('libelle', 'label'))) {
switch ($tabname) {
case MAIN_DB_PREFIX . 'c_accounting_category':
case MAIN_DB_PREFIX . 'c_ecotaxe':
case MAIN_DB_PREFIX . 'c_email_senderprofile':
case MAIN_DB_PREFIX . 'c_forme_juridique':
case MAIN_DB_PREFIX . 'c_holiday_types':
case MAIN_DB_PREFIX . 'c_payment_term':
case MAIN_DB_PREFIX . 'c_transport_mode':
case 'c_accounting_category':
case 'c_ecotaxe':
case 'c_email_senderprofile':
case 'c_forme_juridique':
case 'c_holiday_types':
case 'c_payment_term':
case 'c_transport_mode':
$maxlength = ' maxlength="255"';
break;
case MAIN_DB_PREFIX . 'c_email_templates':
case 'c_email_templates':
$maxlength = ' maxlength="180"';
break;
case MAIN_DB_PREFIX . 'c_socialnetworks':
case 'c_socialnetworks':
$maxlength = ' maxlength="150"';
break;
default:
@@ -2558,10 +2534,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$transkey = '';
if (in_array($fieldlist[$field], array('label', 'libelle'))) { // For label
// Special case for labels
if ($tabname == MAIN_DB_PREFIX.'c_civility' && !empty($obj->code)) {
if ($tabname == 'c_civility' && !empty($obj->code)) {
$transkey = "Civility".strtoupper($obj->code);
}
if ($tabname == MAIN_DB_PREFIX.'c_payment_term' && !empty($obj->code)) {
if ($tabname == 'c_payment_term' && !empty($obj->code)) {
$langs->load("bills");
$transkey = "PaymentConditionShort".strtoupper($obj->code);
}

View File

@@ -9878,7 +9878,7 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi
if (is_null($dictvalues)) {
$dictvalues = array();
$sql = "SELECT * FROM ".$tablename." WHERE 1 = 1"; // Here select * is allowed as it is generic code and we don't have list of fields
$sql = "SELECT * FROM ".MAIN_DB_PREFIX.$tablename." WHERE 1 = 1"; // Here select * is allowed as it is generic code and we don't have list of fields
if ($checkentity) {
$sql .= ' AND entity IN (0,'.getEntity($tablename).')';
}