mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fixing style errors.
This commit is contained in:
parent
32ef55cd9e
commit
54d35fa59f
|
|
@ -83,15 +83,15 @@ if ($action == 'set') {
|
|||
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$defaultValues = new DefaultValues($db);
|
||||
$result = $defaultValues->fetchAll('','',0,0,array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
if (!is_array($result) && $result<0) {
|
||||
setEventMessages($defaultValues->error,$defaultValues->errors,'errors');
|
||||
} elseif(count($result)>0) {
|
||||
foreach($result as $defval) {
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
} elseif (count($result)>0) {
|
||||
foreach ($result as $defval) {
|
||||
$defaultValues->id=$defval->id;
|
||||
$resultDel = $defaultValues->delete($user);
|
||||
if ($resultDel<0) {
|
||||
setEventMessages($defaultValues->error,$defaultValues->errors,'errors');
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -103,9 +103,8 @@ if ($action == 'set') {
|
|||
$defaultValues->value=GETPOST('AGENDA_EVENT_DEFAULT_STATUS');
|
||||
$resultCreat=$defaultValues->create($user);
|
||||
if ($resultCreat<0) {
|
||||
setEventMessages($defaultValues->error,$defaultValues->errors,'errors');
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
}
|
||||
|
||||
} elseif ($action == 'specimen') { // For orders
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
|
|
@ -358,10 +357,10 @@ print '<td class="center"> </td>'."\n";
|
|||
print '<td class="right nowrap">'."\n";
|
||||
$defval='na';
|
||||
$defaultValues = new DefaultValues($db);
|
||||
$result = $defaultValues->fetchAll('','',0,0,array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
if (!is_array($result) && $result<0) {
|
||||
setEventMessages($defaultValues->error,$defaultValues->errors,'errors');
|
||||
} elseif(count($result)>0) {
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
} elseif (count($result)>0) {
|
||||
$defval=reset($result)->value;
|
||||
}
|
||||
$formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200');
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
|
|||
$result=$object->create($user);
|
||||
if ($result<0) {
|
||||
$action = '';
|
||||
setEventMessages($object->error,$object->errors,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action = "";
|
||||
|
|
@ -158,8 +158,7 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
|
|||
$defaultvalue = '';
|
||||
}
|
||||
}
|
||||
if (GETPOST('actionmodify'))
|
||||
{
|
||||
if (GETPOST('actionmodify')) {
|
||||
$object->id=$id;
|
||||
$object->type=$mode;
|
||||
$object->page=$urlpage;
|
||||
|
|
@ -169,7 +168,7 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
|
|||
$result=$object->update($user);
|
||||
if ($result<0) {
|
||||
$action = '';
|
||||
setEventMessages($object->error,$object->errors,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action = "";
|
||||
|
|
@ -182,13 +181,12 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
|
|||
}
|
||||
|
||||
// Delete line from delete picto
|
||||
if ($action == 'delete')
|
||||
{
|
||||
if ($action == 'delete') {
|
||||
$object->id=$id;
|
||||
$result=$object->delete($user);
|
||||
if ($result<0) {
|
||||
$action = '';
|
||||
setEventMessages($object->error,$object->errors,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -356,13 +354,12 @@ print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("
|
|||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
$result=$object->fetchAll( $sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
|
||||
$result=$object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
|
||||
|
||||
if (!is_array($result) && $result<0) {
|
||||
|
||||
setEventMessages($object->error, $object->errors,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} elseif (count($result)>0) {
|
||||
foreach($result as $key=>$defaultvalue) {
|
||||
foreach ($result as $key=>$defaultvalue) {
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -383,10 +380,10 @@ if (!is_array($result) && $result<0) {
|
|||
if ($mode != 'focus' && $mode != 'mandatory') {
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($defaultvalue->value).'">';
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -148,23 +148,17 @@ class DefaultValues extends CommonObject
|
|||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
|
||||
// Unset fields that are disabled
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled']))
|
||||
{
|
||||
foreach ($this->fields as $key => $val) {
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) {
|
||||
unset($this->fields[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Translate some data of arrayofkeyval
|
||||
if (is_object($langs))
|
||||
{
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
|
||||
{
|
||||
foreach ($val['arrayofkeyval'] as $key2 => $val2)
|
||||
{
|
||||
if (is_object($langs)) {
|
||||
foreach ($this->fields as $key => $val) {
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
foreach ($val['arrayofkeyval'] as $key2 => $val2) {
|
||||
$this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
|
||||
}
|
||||
}
|
||||
|
|
@ -274,12 +268,12 @@ class DefaultValues extends CommonObject
|
|||
$sqlwhere[] = $key.'='.$value;
|
||||
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.page' || $key == 't.param' || $key == 't.type'){
|
||||
} elseif ($key == 't.page' || $key == 't.param' || $key == 't.type') {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->escape($value).'\'';
|
||||
} elseif ($key == 'customsql') {
|
||||
$sqlwhere[] = $value;
|
||||
} elseif (is_array($value)) {
|
||||
$sqlwhere[] = $key.' IN ('.implode(',',$value).')';
|
||||
$sqlwhere[] = $key.' IN ('.implode(',', $value).')';
|
||||
} else {
|
||||
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
}
|
||||
|
|
@ -300,8 +294,7 @@ class DefaultValues extends CommonObject
|
|||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < ($limit ? min($limit, $num) : $num))
|
||||
{
|
||||
while ($i < ($limit ? min($limit, $num) : $num)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$record = new self($this->db);
|
||||
|
|
|
|||
|
|
@ -612,19 +612,18 @@ class User extends CommonObject
|
|||
{
|
||||
global $conf;
|
||||
if (!empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) {
|
||||
|
||||
// Load user->default_values for user. TODO Save this in memcached ?
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php';
|
||||
|
||||
$defaultValues = new DefaultValues($this->db);
|
||||
$result = $defaultValues->fetchAll('','',0,0,array('t.user_id'=>array(0,$this->id), 'entity'=>array($this->entity,$conf->entity)));
|
||||
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.user_id'=>array(0,$this->id), 'entity'=>array($this->entity,$conf->entity)));
|
||||
|
||||
if (!is_array($result) && $result<0) {
|
||||
setEventMessages($defaultValues->error,$defaultValues->errors,'errors');
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
} elseif(count($result)>0) {
|
||||
foreach($result as $defval) {
|
||||
} elseif (count($result)>0) {
|
||||
foreach ($result as $defval) {
|
||||
if (!empty($defval->page) && !empty($defval->type) && !empty($defval->param)) {
|
||||
$pagewithoutquerystring = $defval->page;
|
||||
$pagequeries = '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user