Clean code
This commit is contained in:
parent
f737e01a31
commit
e3552e7e02
@ -534,7 +534,7 @@ $tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$la
|
||||
$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("EnterACountryOnlyIfSpecificToOneCountry"), 'year'=>$langs->trans("ZeroMeansEveryYear"));
|
||||
$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();
|
||||
@ -1066,11 +1066,7 @@ if ($id)
|
||||
{
|
||||
// If sort order is "country", we use country_code instead
|
||||
if ($sortfield == 'country') $sortfield = 'country_code';
|
||||
$sql .= " ORDER BY ".$db->escape($sortfield);
|
||||
if ($sortorder)
|
||||
{
|
||||
$sql .= " ".strtoupper($db->escape($sortorder));
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= ", ";
|
||||
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
|
||||
$tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i', '', $tabsqlsort[$id]);
|
||||
@ -1111,7 +1107,7 @@ if ($id)
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
$tdsoffields = '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'entity') {
|
||||
@ -1192,7 +1188,8 @@ if ($id)
|
||||
if ($fieldlist[$field] == 'range_ik') { $valuetoshow = $langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field] == 'fk_c_exp_tax_cat') { $valuetoshow = $langs->trans("CarCategory"); }
|
||||
if ($fieldlist[$field] == 'revenuestamp_type') { $valuetoshow = $langs->trans('TypeOfRevenueStamp'); }
|
||||
if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); }
|
||||
if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); $class = 'center'; }
|
||||
if ($fieldlist[$field] == 'unit_type') { $valuetoshow = $langs->trans('TypeOfUnit'); }
|
||||
|
||||
if ($id == 2) // Special case for state page
|
||||
{
|
||||
@ -1202,28 +1199,27 @@ if ($id)
|
||||
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td'.($class ? ' class="'.$class.'"' : '').'>';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (!empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
$tdsoffields .= '<td'.($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])) $tdsoffields .= $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
else $tdsoffields .= $valuetoshow;
|
||||
$tdsoffields .= '</td>';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
|
||||
if ($id == 4) print '<td></td>';
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
if ($id == 4) $tdsoffields .= '<td></td>';
|
||||
$tdsoffields .= '<td>';
|
||||
$tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">';
|
||||
if (!is_null($withentity))
|
||||
print '<input type="hidden" name="entity" value="'.$withentity.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '</tr>';
|
||||
$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 .= '</tr>';
|
||||
|
||||
print $tdsoffields;
|
||||
|
||||
// Line to enter new values
|
||||
print '<!-- line to add new entry -->';
|
||||
print '<tr class="oddeven nodrag nodrop nohover">';
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
@ -1243,6 +1239,10 @@ if ($id)
|
||||
|
||||
if ($id == 3) unset($fieldlist[2]); // Remove field ??? if dictionary Regions
|
||||
|
||||
// Line to enter new values
|
||||
print '<!-- line to add new entry -->';
|
||||
print '<tr class="oddeven nodrag nodrop nohover">';
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
fieldList($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@ -1255,10 +1255,8 @@ if ($id)
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan = count($fieldlist) + 3;
|
||||
if ($id == 4) $colspan++;
|
||||
print "</tr>";
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
@ -1341,6 +1339,10 @@ if ($id)
|
||||
{
|
||||
if ($fieldlist[$field] == 'entity') continue;
|
||||
|
||||
if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabhelp[$id][$value])) {
|
||||
$tabhelp[$id][$value] = $langs->trans('LabelUsedByDefault');
|
||||
}
|
||||
|
||||
// Determines the name of the field in relation to the possible names
|
||||
// in data dictionaries
|
||||
$showfield = 1; // By defaut
|
||||
@ -1365,7 +1367,8 @@ if ($id)
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
if ($fieldlist[$field] == 'position') { $cssprefix = 'right '; }
|
||||
if ($fieldlist[$field] == 'pos') { $cssprefix = 'right '; $valuetoshow = $langs->trans("Position"); }
|
||||
if ($fieldlist[$field] == 'position') { $cssprefix = 'right '; $valuetoshow = $langs->trans("Position"); }
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Label"); }
|
||||
if ($fieldlist[$field] == 'libelle_facture') { $valuetoshow = $langs->trans("LabelOnDocuments"); }
|
||||
if ($fieldlist[$field] == 'country') { $valuetoshow = $langs->trans("Country"); }
|
||||
@ -1406,14 +1409,19 @@ if ($id)
|
||||
if ($fieldlist[$field] == 'range_ik') { $valuetoshow = $langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field] == 'fk_c_exp_tax_cat') { $valuetoshow = $langs->trans("CarCategory"); }
|
||||
if ($fieldlist[$field] == 'revenuestamp_type') { $valuetoshow = $langs->trans('TypeOfRevenueStamp'); }
|
||||
if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); }
|
||||
if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); $cssprefix = 'center '; }
|
||||
if ($fieldlist[$field] == 'unit_type') { $valuetoshow = $langs->trans('TypeOfUnit'); }
|
||||
|
||||
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; }
|
||||
|
||||
// Show field title
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) $newvaluetoshow = '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (!empty($tabhelp[$id][$value])) $newvaluetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
else $newvaluetoshow = $valuetoshow;
|
||||
|
||||
print getTitleFieldOfList($newvaluetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
|
||||
}
|
||||
}
|
||||
// Favorite - Only activated on country dictionary
|
||||
@ -1635,6 +1643,8 @@ if ($id)
|
||||
if ($fieldlist[$field] == 'position') $class .= ' right';
|
||||
if ($fieldlist[$field] == 'localtax1_type') $class .= ' nowrap';
|
||||
if ($fieldlist[$field] == 'localtax2_type') $class .= ' nowrap';
|
||||
if ($fieldlist[$field] == 'pos') $class .= ' right';
|
||||
if ($fieldlist[$field] == 'use_default') $class .= ' center';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
@ -1981,7 +1991,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
|
||||
$classtd = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') $class = 'maxwidth100';
|
||||
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class = 'maxwidth50';
|
||||
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) {
|
||||
$class = 'maxwidth50 center';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('use_default'))) {
|
||||
$classtd = 'center';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class = 'quatrevingtpercent';
|
||||
print '<td class="'.$classtd.'">';
|
||||
$transfound = 0;
|
||||
|
||||
@ -1158,7 +1158,7 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container" >';
|
||||
print img_picto('', 'project', 'class="paddingrightonly"');
|
||||
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
print $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
$urloption = '?action=create&donotclearsession=1';
|
||||
@ -1183,7 +1183,7 @@ if ($action == 'create')
|
||||
print img_picto('', 'projecttask', 'class="paddingrightonly"');
|
||||
$projectsListId = false;
|
||||
if (!empty($projectid)) { $projectsListId = $projectid; }
|
||||
$tid = GETPOST("projecttaskid") ?GETPOST("projecttaskid") : '';
|
||||
$tid = GETPOST("projecttaskid") ? GETPOST("projecttaskid") : '';
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1194,10 +1194,10 @@ if ($action == 'create')
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
|
||||
print '<td colspan="3">'.dolGetElementUrl($originid, $origin, 1).'</td></tr>';
|
||||
print '<input type="hidden" name="fk_element" size="10" value="'.GETPOST('originid').'">';
|
||||
print '<input type="hidden" name="elementtype" size="10" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" size="10" value="'.GETPOST('originid').'">';
|
||||
print '<input type="hidden" name="origin" size="10" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="fk_element" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="elementtype" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
}
|
||||
|
||||
$reg = array();
|
||||
|
||||
@ -375,7 +375,7 @@ class FormCompany extends Form
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
@ -407,6 +407,7 @@ class FormCompany extends Form
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
print ajax_combobox($htmlname);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
@ -261,7 +261,8 @@ class FormProjets
|
||||
'key' => (int) $obj->rowid,
|
||||
'value' => $obj->ref,
|
||||
'ref' => $obj->ref,
|
||||
'label' => $labeltoshow,
|
||||
'labelx' => $labeltoshow,
|
||||
'label' => ((bool) $disabled) ? '<span class="opacitymedium">'.$labeltoshow.'</span>' : $labeltoshow,
|
||||
'disabled' => (bool) $disabled
|
||||
);
|
||||
}
|
||||
@ -297,7 +298,7 @@ class FormProjets
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
|
||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable)
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param string $morecss More css added to the select component
|
||||
|
||||
@ -129,9 +129,9 @@ class modTicket extends DolibarrModules
|
||||
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f'
|
||||
),
|
||||
'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"),
|
||||
'tabfield' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabfieldvalue' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabfieldinsert' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"),
|
||||
'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default"),
|
||||
'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default"),
|
||||
'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default"),
|
||||
'tabrowid' => array("rowid", "rowid", "rowid", "rowid"),
|
||||
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled),
|
||||
'tabhelp' => array(array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1"))),
|
||||
|
||||
@ -1028,6 +1028,7 @@ DictionaryOpportunityStatus=Lead status for project/lead
|
||||
DictionaryExpenseTaxCat=Expense report - Transportation categories
|
||||
DictionaryExpenseTaxRange=Expense report - Range by transportation category
|
||||
DictionaryTransportMode=Intracomm report - Transport mode
|
||||
TypeOfUnit=Type of unit
|
||||
SetupSaved=Setup saved
|
||||
SetupNotSaved=Setup not saved
|
||||
BackToModuleList=Back to Module list
|
||||
@ -2066,3 +2067,4 @@ TemplateDeleted=Template deleted
|
||||
MailToSendEventPush=Template for event reminder emails
|
||||
SwitchThisForABetterSecurity=Switching this value to %s is recommended for more security
|
||||
DictionaryProductNature= Nature of product
|
||||
CountryIfSpecificToOneCountry=Country (if specific to a given country)
|
||||
Loading…
Reference in New Issue
Block a user