diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php
index 93950979a1a..a013bb57a36 100644
--- a/htdocs/hrm/class/job.class.php
+++ b/htdocs/hrm/class/job.class.php
@@ -1054,6 +1054,37 @@ class Job extends CommonObject
return $error;
}
+
+ /**
+ * Return clicable link of object (with eventually picto)
+ *
+ * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
+ * @return string HTML Code for Kanban thumb.
+ */
+ public function getKanbanView($option = '')
+ {
+ global $selected, $langs;
+ $return = '
';
+ $return .= '
';
+ $return .= '
';
+ $return .= img_picto('', $this->picto);
+ $return .= ' ';
+ $return .= '
';
+ $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).' ';
+ $return .= ' ';
+ if (property_exists($this, 'deplacement')) {
+ $return .= ''.$langs->trans("Type").' ';
+ $return .= ' : '.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].' ';
+ }
+ if (property_exists($this, 'description') && !(empty($this->description))) {
+ $return .= ''.$langs->trans("Description").' : ';
+ $return .= ''.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).' ';
+ }
+ $return .= '
';
+ $return .= '
';
+ $return .= '
';
+ return $return;
+ }
}
diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php
index ed0fb480a3a..6e97c0d0483 100644
--- a/htdocs/hrm/job_list.php
+++ b/htdocs/hrm/job_list.php
@@ -52,6 +52,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'joblist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
+$mode = GETPOST('mode', 'alpha'); // for view result with other mode
$id = GETPOST('id', 'int');
@@ -362,6 +363,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
+if (!empty($mode)) {
+ $param .= '&mode='.urlencode($mode);
+}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@@ -413,8 +417,13 @@ print ' ';
print ' ';
print ' ';
print ' ';
+print ' ';
-$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/job_card.php', 1).'?action=create', '', $permissiontoadd);
+
+$newcardbutton = '';
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
+$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/job_card.php', 1).'?action=create', '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@@ -561,78 +570,100 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Store properties in $object
$object->setVarsFromFetchObj($obj);
- // Show here line of result
- print '';
- foreach ($object->fields as $key => $val) {
- $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
- if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
- $cssforfield .= ($cssforfield ? ' ' : '').'center';
- } elseif ($key == 'status') {
- $cssforfield .= ($cssforfield ? ' ' : '').'center';
+ if ($mode == 'kanban') {
+ if ($i == 0) {
+ print ' ';
+ print '';
}
+ // Output Kanban
- if (in_array($val['type'], array('timestamp'))) {
- $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
- } elseif ($key == 'ref') {
- $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
- }
+ $object->deplacement = $obj->deplacement;
+ $object->description = $obj->description;
- if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
- $cssforfield .= ($cssforfield ? ' ' : '').'right';
- }
- //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
-
- if (!empty($arrayfields['t.'.$key]['checked'])) {
- print '
';
- if ($key == 'status') {
- print $object->getLibStatut(5);
- } elseif ($key == 'rowid') {
- print $object->showOutputField($val, $key, $object->id, '');
- } elseif ($key == 'label') {
- print $object->getNomUrl(1);
- } else {
- print $object->showOutputField($val, $key, $object->$key, '');
+ 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;
+ if (in_array($object->id, $arrayofselected)) {
+ $selected = 1;
}
- print ' ';
- if (!$i) {
- $totalarray['nbfield']++;
+ print $object->getKanbanView('');
+ }
+ if ($i == (min($num, $limit) - 1)) {
+ print '';
+ print ' ';
+ }
+ } else {
+ // Show here line of result
+ print '';
+ foreach ($object->fields as $key => $val) {
+ $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
+ if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
+ } elseif ($key == 'status') {
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
}
- if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
+
+ if (in_array($val['type'], array('timestamp'))) {
+ $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+ } elseif ($key == 'ref') {
+ $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+ }
+
+ if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
+ $cssforfield .= ($cssforfield ? ' ' : '').'right';
+ }
+ //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
+
+ if (!empty($arrayfields['t.'.$key]['checked'])) {
+ print '';
+ if ($key == 'status') {
+ print $object->getLibStatut(5);
+ } elseif ($key == 'rowid') {
+ print $object->showOutputField($val, $key, $object->id, '');
+ } elseif ($key == 'label') {
+ print $object->getNomUrl(1);
+ } else {
+ print $object->showOutputField($val, $key, $object->$key, '');
+ }
+ print ' ';
if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
+ $totalarray['nbfield']++;
}
- if (!isset($totalarray['val'])) {
- $totalarray['val'] = array();
+ if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
+ }
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
+ $totalarray['val']['t.'.$key] += $object->$key;
}
- if (!isset($totalarray['val']['t.'.$key])) {
- $totalarray['val']['t.'.$key] = 0;
- }
- $totalarray['val']['t.'.$key] += $object->$key;
}
}
- }
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- // Action column
- print '';
- 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;
- if (in_array($object->id, $arrayofselected)) {
- $selected = 1;
+ // Extra fields
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+ // Fields from hook
+ $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ // Action column
+ print ' ';
+ 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;
+ if (in_array($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
- print ' ';
- }
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
- }
-
- print ' '."\n";
+ print ''."\n";
+ }
$i++;
}