Look and feel v14

This commit is contained in:
Laurent Destailleur 2021-03-20 18:43:44 +01:00
parent e1f23105a6
commit 8df083c955
3 changed files with 151 additions and 123 deletions

View File

@ -19,8 +19,8 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup. * The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup.
* API /setup/shipment_methods has been replaced with API /setup/shipping_methods * API /setup/shipment_methods has been replaced with API /setup/shipping_methods
* Field "tva" renamed into "total_tva" in llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency * Field "tva" renamed into "total_tva" for table llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency
* Field "total" renamed into "total_ttc" in llx_propal, llx_supplier_proposal for better field name consistency * Field "total" renamed into "total_ttc" for table lx_propal, llx_supplier_proposal for better field name consistency
* If your database is PostgreSql, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT) * If your database is PostgreSql, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT)
* If your database is MySql or MariaDB, you need at least version 5.1 * If your database is MySql or MariaDB, you need at least version 5.1

View File

@ -32,6 +32,8 @@ $langs->load("users");
// Security check // Security check
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$object = new User($db); $object = new User($db);
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref, '', 1); $result = $object->fetch($id, $ref, '', 1);

View File

@ -32,9 +32,11 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php';
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('companies', 'mails', 'admin', 'other')); $langs->loadLangs(array('companies', 'mails', 'admin', 'other', 'errors'));
$id = GETPOST("id", 'int'); $id = GETPOST("id", 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$actionid = GETPOST('actionid'); $actionid = GETPOST('actionid');
@ -63,11 +65,24 @@ $pagenext = $page + 1;
$now = dol_now(); $now = dol_now();
// Security check
$object = new User($db);
if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref, '', 1);
$object->getrights();
}
$permissiontoadd = (($object->id == $user->id) || (!empty($user->rights->user->user->lire)));
/* /*
* Actions * Actions
*/ */
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
}
// Add a notification // Add a notification
if ($action == 'add') { if ($action == 'add') {
$error = 0; $error = 0;
@ -75,6 +90,7 @@ if ($action == 'add') {
if ($actionid <= 0) { if ($actionid <= 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Action")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Action")), null, 'errors');
$error++; $error++;
$action = 'create';
} }
if (!$error) { if (!$error) {
@ -98,6 +114,7 @@ if ($action == 'add') {
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
$action = 'create';
} }
} }
} }
@ -185,7 +202,7 @@ if ($result > 0) {
// Add notification form // Add notification form
print load_fiche_titre($langs->trans("AddNewNotification"), '', ''); // print load_fiche_titre($langs->trans("AddNewNotification"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
@ -194,7 +211,7 @@ if ($result > 0) {
$param = "&id=".$id; $param = "&id=".$id;
// Line with titles // Line with titles
print '<table width="100%" class="noborder">'; /* print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], "c.lastname,c.firstname", '', $param, 'width="45%"', $sortfield, $sortorder); print_liste_field_titre("Target", $_SERVER["PHP_SELF"], "c.lastname,c.firstname", '', $param, 'width="45%"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", '', $param, 'width="35%"', $sortfield, $sortorder); print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", '', $param, 'width="35%"', $sortfield, $sortorder);
@ -202,7 +219,47 @@ if ($result > 0) {
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";
print '</table>';
print '<br>';
*/
// List of notifications enabled for contacts
$sql = "SELECT n.rowid, n.type,";
$sql .= " a.code, a.label,";
$sql .= " c.rowid as userid, c.lastname, c.firstname, c.email";
$sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
$sql .= " ".MAIN_DB_PREFIX."notify_def as n,";
$sql .= " ".MAIN_DB_PREFIX."user c";
$sql .= " WHERE a.rowid = n.fk_action";
$sql .= " AND c.rowid = n.fk_user";
$sql .= " AND c.rowid = ".$object->id;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
} else {
dol_print_error($db);
}
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
$title = $langs->trans("ListOfActiveNotifications");
// List of active notifications
//print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')', '', '');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $num, 'email', 0, $newcardbutton, '', $limit, 0, 0, 1);
// Line with titles
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], "c.lastname,c.firstname", '', $param, 'width="45%"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", '', $param, 'width="35%"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "n.type", '', $param, 'width="10%"', $sortfield, $sortorder);
print_liste_field_titre('', '', '');
print '</tr>';
if ($action == 'create') {
// $listofemails=$object->thirdparty_and_contact_email_array(); // $listofemails=$object->thirdparty_and_contact_email_array();
if ($object->email) { if ($object->email) {
$actions = array(); $actions = array();
@ -231,52 +288,18 @@ if ($result > 0) {
$type = array('email'=>$langs->trans("EMail")); $type = array('email'=>$langs->trans("EMail"));
print $form->selectarray("typeid", $type); print $form->selectarray("typeid", $type);
print '</td>'; print '</td>';
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>'; print '<td class="nowraponall">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '</tr>'; print '</tr>';
} else { } else {
print '<tr class="oddeven"><td colspan="4">'; print '<tr class="oddeven"><td colspan="4">';
print $langs->trans("YouMustAssignUserMailFirst"); print $langs->trans("YouMustAssignUserMailFirst");
print '</td></tr>'; print '</td></tr>';
} }
print '</table>';
print '</form>';
print '<br>';
// List of notifications enabled for contacts
$sql = "SELECT n.rowid, n.type,";
$sql .= " a.code, a.label,";
$sql .= " c.rowid as userid, c.lastname, c.firstname, c.email";
$sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
$sql .= " ".MAIN_DB_PREFIX."notify_def as n,";
$sql .= " ".MAIN_DB_PREFIX."user c";
$sql .= " WHERE a.rowid = n.fk_action";
$sql .= " AND c.rowid = n.fk_user";
$sql .= " AND c.rowid = ".$object->id;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
} else { } else {
dol_print_error($db);
}
// List of active notifications
print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')', '', '');
// Line with titles
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], "c.lastname,c.firstname", '', $param, 'width="45%"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", '', $param, 'width="35%"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "n.type", '', $param, 'width="10%"', $sortfield, $sortorder);
print_liste_field_titre('', '', '');
print '</tr>';
$langs->load("errors");
$langs->load("other");
if ($num) { if ($num) {
$i = 0; $i = 0;
@ -364,9 +387,12 @@ if ($result > 0) {
print '+ <a href="'.DOL_URL_ROOT.'/admin/notification.php">'.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'</a>'; print '+ <a href="'.DOL_URL_ROOT.'/admin/notification.php">'.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'</a>';
print '</td></tr>'; print '</td></tr>';
}*/ }*/
}
print '</table>'; print '</table>';
print '</form>';
print '<br><br>'."\n"; print '<br><br>'."\n";
@ -422,7 +448,7 @@ if ($result > 0) {
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
// List of notifications done // List of notifications done
print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'email', 0, '', '', $limit);
// Line with titles // Line with titles
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';