Add some fields in candidature

Look and feel v13
This commit is contained in:
Laurent Destailleur 2020-09-08 01:53:37 +02:00
parent b5376d3322
commit c91338198d
11 changed files with 112 additions and 77 deletions

View File

@ -200,17 +200,17 @@ class FormTicket
// Type // Type
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">'.$langs->trans("TicketTypeRequest").'</span></label></td><td>'; print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">'.$langs->trans("TicketTypeRequest").'</span></label></td><td>';
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', '2', 0, 0, 0, 'minwidth150'); $this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 0, 0, 0, 'minwidth200');
print '</td></tr>';
// Severity
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2');
print '</td></tr>'; print '</td></tr>';
// Group // Group
print '<tr><td><span class="fieldrequired"><label for="selectcategory_code">'.$langs->trans("TicketCategory").'</span></label></td><td>'; print '<tr><td><span class="fieldrequired"><label for="selectcategory_code">'.$langs->trans("TicketCategory").'</span></label></td><td>';
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', 2, 0, 0, 0, 'minwidth200');
print '</td></tr>';
// Severity
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 0);
print '</td></tr>'; print '</td></tr>';
// Subject // Subject
@ -247,6 +247,59 @@ class FormTicket
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
// Attached files
if (!empty($this->withfile)) {
// Define list of attached files
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
if (!empty($_SESSION["listofpaths"])) {
$listofpaths = explode(';', $_SESSION["listofpaths"]);
}
if (!empty($_SESSION["listofnames"])) {
$listofnames = explode(';', $_SESSION["listofnames"]);
}
if (!empty($_SESSION["listofmimes"])) {
$listofmimes = explode(';', $_SESSION["listofmimes"]);
}
$out = '<tr>';
$out .= '<td>'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
}
$out .= '<br></div>';
}
} else {
$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) { // Can add other files
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="'.$langs->trans("MailingAddFile").'" />';
}
$out .= "</td></tr>\n";
print $out;
}
// User of creation // User of creation
if ($this->withusercreate > 0 && $this->fk_user_create) { if ($this->withusercreate > 0 && $this->fk_user_create) {
print '<tr><td class="titlefield">'.$langs->trans("CreatedBy").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("CreatedBy").'</td><td>';
@ -359,58 +412,6 @@ class FormTicket
print '</td></tr>'; print '</td></tr>';
} }
// Attached files
if (!empty($this->withfile)) {
// Define list of attached files
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
if (!empty($_SESSION["listofpaths"])) {
$listofpaths = explode(';', $_SESSION["listofpaths"]);
}
if (!empty($_SESSION["listofnames"])) {
$listofnames = explode(';', $_SESSION["listofnames"]);
}
if (!empty($_SESSION["listofmimes"])) {
$listofmimes = explode(';', $_SESSION["listofmimes"]);
}
$out = '<tr>';
$out .= '<td>'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
}
$out .= '<br></div>';
}
} else {
$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) { // Can add other files
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="'.$langs->trans("MailingAddFile").'" />';
}
$out .= "</td></tr>\n";
print $out;
}
// Other attributes // Other attributes
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook

View File

@ -60,9 +60,10 @@ foreach ($object->fields as $key => $val)
print '<td class="valuefield fieldname_'.$key; print '<td class="valuefield fieldname_'.$key;
if ($val['type'] == 'text') print ' wordbreak'; if ($val['type'] == 'text') print ' wordbreak';
print '">'; print '">';
if (in_array($val['type'], array('text', 'html'))) print '<div class="longmessagecut">';
print $object->showOutputField($val, $key, $value, '', '', '', 0); print $object->showOutputField($val, $key, $value, '', '', '', 0);
//print dol_escape_htmltag($object->$key, 1, 1); //print dol_escape_htmltag($object->$key, 1, 1);
if (in_array($val['type'], array('text', 'html'))) print '</div>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -105,8 +106,10 @@ foreach ($object->fields as $key => $val)
else print $langs->trans($val['label']); else print $langs->trans($val['label']);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (in_array($val['type'], array('text', 'html'))) print '<div class="longmessagecut">';
print $object->showOutputField($val, $key, $value, '', '', '', 0); print $object->showOutputField($val, $key, $value, '', '', '', 0);
//print dol_escape_htmltag($object->$key, 1, 1); //print dol_escape_htmltag($object->$key, 1, 1);
if (in_array($val['type'], array('text', 'html'))) print '</div>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -314,3 +314,7 @@ ALTER TABLE llx_inventorydet ADD UNIQUE uk_inventorydet(fk_inventory, fk_warehou
ALTER TABLE llx_commandedet ADD COLUMN ref_ext varchar(255) AFTER label; ALTER TABLE llx_commandedet ADD COLUMN ref_ext varchar(255) AFTER label;
ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_total_ttc; ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_total_ttc;
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL;
ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL;

View File

@ -17,12 +17,14 @@
create table llx_c_ticket_category create table llx_c_ticket_category
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1, entity integer DEFAULT 1,
code varchar(32) NOT NULL, code varchar(32) NOT NULL,
pos varchar(32) NOT NULL, pos varchar(32) NOT NULL,
label varchar(128) NOT NULL, label varchar(128) NOT NULL,
active integer DEFAULT 1, active integer DEFAULT 1,
use_default integer DEFAULT 1, use_default integer DEFAULT 1,
description varchar(255) fk_parent integer DEFAULT 0 NOT NULL; -- Parent group
force_severity varchar(32) NULL, -- To force the severity if we choosed this category
description varchar(255)
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -41,10 +41,12 @@ function recruitmentCandidaturePrepareHead($object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
$head[$h][0] = dol_buildpath("/recruitment/recruitmentrating_card.php", 1).'?id='.$object->id; if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$head[$h][1] = $langs->trans("Rating"); $head[$h][0] = dol_buildpath("/recruitment/recruitmentrating_card.php", 1).'?id='.$object->id;
$head[$h][2] = 'rating'; $head[$h][1] = $langs->trans("Rating");
$h++; $head[$h][2] = 'rating';
$h++;
}
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
{ {

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com> /* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -701,6 +701,12 @@ textarea.centpercent {
.text-warning{ .text-warning{
color : <?php print $textWarning; ?> color : <?php print $textWarning; ?>
} }
.longmessagecut {
max-height: 250px;
max-width: 100%;
overflow-y: scroll;
}
body[class*="colorblind-"] .text-warning{ body[class*="colorblind-"] .text-warning{
color : <?php print $colorblind_deuteranopes_textWarning; ?> color : <?php print $colorblind_deuteranopes_textWarning; ?>
} }

View File

@ -788,6 +788,11 @@ textarea.centpercent {
font-size: 0.85em; font-size: 0.85em;
opacity: 0.7; opacity: 0.7;
} }
.longmessagecut {
max-height: 250px;
max-width: 100%;
overflow-y: scroll;
}
.text-warning{ .text-warning{
color : <?php print $textWarning; ?> color : <?php print $textWarning; ?>

View File

@ -639,7 +639,7 @@ if ($action == 'create' || $action == 'presend')
$formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withfromcontactid = $contactid ? $contactid : '';
$formticket->withtitletopic = 1; $formticket->withtitletopic = 1;
$formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : 0); $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : 0);
$formticket->withusercreate = 1; $formticket->withusercreate = 0;
$formticket->withref = 1; $formticket->withref = 1;
$formticket->fk_user_create = $user->id; $formticket->fk_user_create = $user->id;
$formticket->withfile = 2; $formticket->withfile = 2;

View File

@ -208,14 +208,24 @@ class ActionsTicket
$msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message; $msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message;
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$uselocalbrowser = true; $uselocalbrowser = true;
$doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_4, '95%'); $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_9, '95%');
$doleditor->Create(); $doleditor->Create();
} else { } else {
// Deal with format differences (text / HTML) // Deal with format differences (text / HTML)
if (dol_textishtml($object->message)) { if (dol_textishtml($object->message)) {
print '<div class="longmessagecut">';
print $object->message; print $object->message;
print '</div>';
/*print '<div class="clear center">';
print $langs->trans("More").'...';
print '</div>';*/
} else { } else {
print '<div class="longmessagecut">';
print dol_nl2br($object->message); print dol_nl2br($object->message);
print '</div>';
/*print '<div class="clear center">';
print $langs->trans("More").'...';
print '</div>';*/
} }
//print '<div>' . $object->message . '</div>'; //print '<div>' . $object->message . '</div>';

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io> /* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -229,7 +230,7 @@ class Ticket extends CommonObject
'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200', 'autofocusoncreate'=>1), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200', 'autofocusoncreate'=>1),
'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth150'), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth150'),
'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'),
'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"),