Clean code

This commit is contained in:
Laurent Destailleur 2020-10-17 15:53:31 +02:00
parent 27698ab5c7
commit 7b20e703ee
6 changed files with 31 additions and 26 deletions

View File

@ -1122,8 +1122,7 @@ if ($action == 'create')
{
// Related company
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
if (GETPOST('socid', 'int') > 0)
{
if (GETPOST('socid', 'int') > 0) {
$societe = new Societe($db);
$societe->fetch(GETPOST('socid', 'int'));
print $societe->getNomUrl(1);

View File

@ -1504,9 +1504,6 @@ if ($action == 'create')
print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
print '</td>';
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
$shipping_method_id = $soc->shipping_method_id;
}
} else {
print '<td>';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500');
@ -1587,6 +1584,9 @@ if ($action == 'create')
// Shipping Method
if (!empty($conf->expedition->enabled)) {
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
$shipping_method_id = $soc->shipping_method_id;
}
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>';

View File

@ -1249,7 +1249,7 @@ class Form
if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
else $textifempty .= $langs->trans("All");
}
if ($showempty) $out .= '<option value="-1">'.$textifempty.'</option>'."\n";
if ($showempty) $out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.$textifempty.'</span>').'">'.$textifempty.'</option>'."\n";
$num = $this->db->num_rows($resql);
$i = 0;
@ -1284,10 +1284,10 @@ class Form
if ($obj->client || $obj->fournisseur) $label .= ')';
}
if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
$label .= '-'.$obj->address.'-'.$obj->zip.' '.$obj->town;
if (! empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
$label .= ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
if (!empty($obj->country_code)) {
$label .= ' '.$langs->trans('Country'.$obj->country_code);
$label .= ', '.$langs->trans('Country'.$obj->country_code);
}
}
@ -3274,6 +3274,7 @@ class Form
}
print '</select>';
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ajax_combobox($htmlname);
}
/**
@ -3357,6 +3358,7 @@ class Form
}
print '</select>';
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ajax_combobox('select_'.$htmlname);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -3706,6 +3708,8 @@ class Form
}
print "</select>";
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ajax_combobox('select'.$htmlname);
} else {
print $langs->trans("NoShippingMethodDefined");
}

View File

@ -2009,7 +2009,7 @@ DisabledResourceLinkContact=Disable feature to link a resource to contacts
EnableResourceUsedInEventCheck=Enable feature to check if a resource is in use in an event
ConfirmUnactivation=Confirm module reset
OnMobileOnly=On small screen (smartphone) only
DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both)
DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be "Prospect" or "Customer", but can't be both)
MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person
MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links.
MAIN_OPTIMIZEFORCOLORBLIND=Change interface's color for color blind person

View File

@ -800,22 +800,24 @@ if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST))
print '</a></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("AskForPreferredShippingMethod").'</td>';
print '<td>&nbsp</td>';
print '<td class="center">';
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD))
{
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
if (!empty($conf->expedition->enabled)) {
if (! empty($conf->global->MAIN_FEATURES_LEVEL)) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal)
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("AskForPreferredShippingMethod").'</td>';
print '<td>&nbsp</td>';
print '<td class="center">';
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD))
{
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
}
print '</a></td>';
print '</tr>';
}
}
print '</a></td>';
print '</tr>';
// Disable Prospect/Customer thirdparty type
print '<tr class="oddeven">';

View File

@ -764,7 +764,7 @@ class Societe extends CommonObject
$this->tva_assuj = 1;
$this->status = 1;
if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
if (! empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
$this->fields['address']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST;
$this->fields['zip']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST;
$this->fields['town']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST;