|
@@ -43,6 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
|
|
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
|
|
|
|
|
$id = GETPOST('id', 'int');
|
|
|
+$rowid = GETPOST('rowid', 'alpha');
|
|
|
|
|
|
// Load variable for pagination
|
|
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|
@@ -122,6 +123,10 @@ $permissiontoread = $user->admin;
|
|
|
$permissiontoadd = $user->admin;
|
|
|
$permissiontodelete = $user->admin;
|
|
|
|
|
|
+if ($id > 0) {
|
|
|
+ $object->fetch($id);
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
* Actions
|
|
@@ -191,7 +196,6 @@ $now = dol_now();
|
|
|
$help_url = '';
|
|
|
$title = $langs->trans("EMailsSetup");
|
|
|
|
|
|
-
|
|
|
llxHeader('', $title);
|
|
|
|
|
|
$linkback = '';
|
|
@@ -230,7 +234,7 @@ foreach ($search as $key => $val)
|
|
|
{
|
|
|
if ($key == 'status' && $search[$key] == -1) continue;
|
|
|
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
|
|
- if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
|
|
+ if (strpos($object->fields[$key]['type'], 'integer:') === 0 || $key == 'active') {
|
|
|
if ($search[$key] == '-1') $search[$key] = '';
|
|
|
$mode_search = 2;
|
|
|
}
|
|
@@ -347,15 +351,41 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
|
|
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
-print '<input type="hidden" name="action" value="'.($action == 'create' ? 'add' : 'list').'">';
|
|
|
+print '<input type="hidden" name="action" value="'.($action == 'create' ? 'add' : ($action == 'edit' ? 'update' : 'list')).'">';
|
|
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
|
|
+print '<input type="hidden" name="id" value="'.$id.'">';
|
|
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
|
|
|
$newcardbutton = '';
|
|
|
if ($action != 'create') {
|
|
|
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd);
|
|
|
+
|
|
|
+ if ($action == 'edit') {
|
|
|
+ print '<table class="border centpercent tableforfield">';
|
|
|
+ print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.(GETPOSTISSET('label') ? GETPOST('label', 'alphanohtml') : $object->label).'"></td></tr>';
|
|
|
+ print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.(GETPOSTISSET('email') ? GETPOST('email', 'alphanohtml') : $object->email).'"></td></tr>';
|
|
|
+ print '<tr><td>'.$langs->trans("Signature").'</td><td>';
|
|
|
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|
|
+ $doleditor = new DolEditor('signature', (GETPOSTISSET('signature') ? GETPOST('signature', 'restricthtml') : $object->signature), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
|
|
|
+ print $doleditor->Create(1);
|
|
|
+ print '</td></tr>';
|
|
|
+ print '<tr><td>'.$langs->trans("User").'</td><td>';
|
|
|
+ print $form->select_dolusers((GETPOSTISSET('private') ? GETPOST('private', 'int') : $object->private), 'private', 1, null, 0, ($user->admin ? '' : $user->id));
|
|
|
+ print '</td></tr>';
|
|
|
+ print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.(GETPOSTISSET('position') ? GETPOST('position', 'int') : $object->position).'"></td></tr>';
|
|
|
+ print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
|
|
+ print $form->selectarray('active', $object->fields['active']['arrayofkeyval'], (GETPOSTISSET('active') ? GETPOST('active', 'int') : $object->active), 0, 0, 0, '', 1);
|
|
|
+ print '</td></tr>';
|
|
|
+ print '</table>';
|
|
|
+ print '<br>';
|
|
|
+ print '<div class="center">';
|
|
|
+ print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
|
|
+ print ' ';
|
|
|
+ print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
|
|
+ print '</div>';
|
|
|
+ }
|
|
|
} else {
|
|
|
/*print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
@@ -367,7 +397,7 @@ if ($action != 'create') {
|
|
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
*/
|
|
|
print '<table class="border centpercent tableforfield">';
|
|
|
- print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
|
|
|
+ print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
|
|
|
print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>';
|
|
|
print '<tr><td>'.$langs->trans("Signature").'</td><td>';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|
@@ -531,7 +561,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
|
|
if (!empty($arrayfields['t.'.$key]['checked']))
|
|
|
{
|
|
|
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
|
|
- if ($key == 'status') print $object->getLibStatut(5);
|
|
|
+ if ($key == 'status' || $key == 'active') print $object->getLibStatut(5);
|
|
|
else print $object->showOutputField($val, $key, $object->$key, '');
|
|
|
print '</td>';
|
|
|
if (!$i) $totalarray['nbfield']++;
|
|
@@ -550,14 +580,14 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
|
|
print $hookmanager->resPrint;
|
|
|
// Action column
|
|
|
print '<td class="nowrap center">';
|
|
|
- $url = $_SERVER["PHP_SELF"].'?action=list&id='.$obj->rowid;
|
|
|
+ $url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid;
|
|
|
if ($limit) $url .= '&limit='.urlencode($limit);
|
|
|
if ($page) $url .= '&page='.urlencode($page);
|
|
|
if ($sortfield) $url .= '&sortfield='.urlencode($sortfield);
|
|
|
if ($sortorder) $url .= '&page='.urlencode($sortorder);
|
|
|
- //print '<a class="reposition" href="'.$url.'&action=edit">'.img_edit().'</a>';
|
|
|
+ print '<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.'&action=edit&rowid='.$obj->rowid.'">'.img_edit().'</a>';
|
|
|
//print ' ';
|
|
|
- print '<a href="'.$url.'&action=delete">'.img_delete().'</a> ';
|
|
|
+ print '<a class=" marginrightonly marginleftonly" href="'.$url.'&action=delete">'.img_delete().'</a> ';
|
|
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
|
|
{
|
|
|
$selected = 0;
|