Fixing style errors.

This commit is contained in:
stickler-ci 2020-09-14 09:01:11 +00:00
parent 92aab677e9
commit ad84aaacc6
2 changed files with 47 additions and 52 deletions

View File

@ -397,8 +397,8 @@ if (empty($reshook))
$object->note = $object->note_private; $object->note = $object->note_private;
} }
$object->customcode = GETPOST('customcode', 'alpha'); $object->customcode = GETPOST('customcode', 'alpha');
$object->country_id = GETPOST('country_id', 'int'); $object->country_id = GETPOST('country_id', 'int');
$object->state_id = GETPOST('state_id', 'int'); $object->state_id = GETPOST('state_id', 'int');
$object->status = GETPOST('statut', 'int'); $object->status = GETPOST('statut', 'int');
$object->status_buy = GETPOST('statut_buy', 'int'); $object->status_buy = GETPOST('statut_buy', 'int');
$object->status_batch = GETPOST('status_batch', 'aZ09'); $object->status_batch = GETPOST('status_batch', 'aZ09');
@ -904,17 +904,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
$objcanvas->display_canvas($action); // Show template $objcanvas->display_canvas($action); // Show template
} else { } else {
// ----------------------------------------- // -----------------------------------------
// When used in standard mode // When used in standard mode
// ----------------------------------------- // -----------------------------------------
if ($action == 'create' && $usercancreate) if ($action == 'create' && $usercancreate)
{ {
//WYSIWYG Editor //WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
$("#selectcountry_id").change(function() { $("#selectcountry_id").change(function() {
document.formprod.action.value="create"; document.formprod.action.value="create";
@ -1159,7 +1157,7 @@ print '<script type="text/javascript">';
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">'; print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
} }
print $formcompany->select_state($object->state_id, $object->country_code); print $formcompany->select_state($object->state_id, $object->country_code);
print '</tr>'; print '</tr>';
} }
print '</tr>'; print '</tr>';
@ -1365,9 +1363,6 @@ print '<script type="text/javascript">';
print '</form>'; print '</form>';
} elseif ($object->id > 0) { } elseif ($object->id > 0) {
/* /*
* Product card * Product card
*/ */
@ -1377,7 +1372,7 @@ print '<script type="text/javascript">';
//WYSIWYG Editor //WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
$("#selectcountry_id").change(function() { $("#selectcountry_id").change(function() {
document.formprod.action.value="edit"; document.formprod.action.value="edit";
@ -1386,14 +1381,14 @@ print '<script type="text/javascript">';
});'; });';
print '</script>'."\n"; print '</script>'."\n";
// We set country_id, country_code and country for the selected country // We set country_id, country_code and country for the selected country
$object->country_id = GETPOST('country_id') ? GETPOST('country_id') : $object->country_id; $object->country_id = GETPOST('country_id') ? GETPOST('country_id') : $object->country_id;
if ($object->country_id) if ($object->country_id)
{ {
$tmparray = getCountry($object->country_id, 'all'); $tmparray = getCountry($object->country_id, 'all');
$object->country_code = $tmparray['code']; $object->country_code = $tmparray['code'];
$object->country = $tmparray['label']; $object->country = $tmparray['label'];
} }
$type = $langs->trans('Product'); $type = $langs->trans('Product');
@ -1594,29 +1589,29 @@ print '<script type="text/javascript">';
if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
{ {
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td></tr>'; print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td></tr>';
// Origin country // Origin country
print '<td>'.$langs->trans("CountryOrigin").'</td>'; print '<td>'.$langs->trans("CountryOrigin").'</td>';
print '<td>'; print '<td>';
print img_picto('', 'globe-americas', 'class="paddingrightonly"'); print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td>'; print '</td>';
// State // State
if (empty($conf->global->PRODUCT_DISABLE_STATE)) if (empty($conf->global->PRODUCT_DISABLE_STATE))
{ {
if ($conf->browser->layout == 'phone') print '</tr><tr>'; if ($conf->browser->layout == 'phone') print '</tr><tr>';
if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2))
{ {
print '<td>'.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).'</td><td colspan="3">'; print '<td>'.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).'</td><td colspan="3">';
} else { } else {
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">'; print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
} }
print $formcompany->select_state($object->state_id, $object->country_code); print $formcompany->select_state($object->state_id, $object->country_code);
print '</td>'; print '</td>';
} }
print '</tr>'; print '</tr>';
} }
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="3"', 'cols' => 3); $parameters = array('colspan' => ' colspan="3"', 'cols' => 3);
@ -2113,8 +2108,8 @@ print '<script type="text/javascript">';
// Origin country code // Origin country code
print '<tr><td>'.$langs->trans("Origin").'</td><td colspan="2">'.getCountry($object->country_id, 0, $db); print '<tr><td>'.$langs->trans("Origin").'</td><td colspan="2">'.getCountry($object->country_id, 0, $db);
if (!empty($object->state_id)) print ' - '.getState($object->state_id, 0, $db); if (!empty($object->state_id)) print ' - '.getState($object->state_id, 0, $db);
print '</td>'; print '</td>';
} }
// Other attributes // Other attributes

View File

@ -1004,7 +1004,7 @@ class Product extends CommonObject
$sql .= ", url = ".($this->url ? "'".$this->db->escape($this->url)."'" : 'null'); $sql .= ", url = ".($this->url ? "'".$this->db->escape($this->url)."'" : 'null');
$sql .= ", customcode = '".$this->db->escape($this->customcode)."'"; $sql .= ", customcode = '".$this->db->escape($this->customcode)."'";
$sql .= ", fk_country = ".($this->country_id > 0 ? (int) $this->country_id : 'null'); $sql .= ", fk_country = ".($this->country_id > 0 ? (int) $this->country_id : 'null');
$sql .= ", fk_state = ".($this->state_id > 0 ? (int) $this->state_id : 'null'); $sql .= ", fk_state = ".($this->state_id > 0 ? (int) $this->state_id : 'null');
$sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null'); $sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null');
$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";