Merge pull request #23534 from lamrani002/kanbanForPrelevementOrder

NEW kanban mode for list of prelevement orders
This commit is contained in:
Laurent Destailleur 2023-01-13 13:19:40 +01:00 committed by GitHub
commit 4141d9d1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 13 deletions

View File

@ -2407,4 +2407,38 @@ class BonPrelevement extends CommonObject
*/ */
return 0; return 0;
} }
/**
* 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 $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'date_echeance')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';
}
if (property_exists($this, 'total')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
}
if (method_exists($this, 'LibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->statut, 5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -54,6 +54,8 @@ if (!$sortfield) {
} }
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha');
// Get supervariables // Get supervariables
$statut = GETPOST('statut', 'int'); $statut = GETPOST('statut', 'int');
@ -147,6 +149,9 @@ if ($result) {
$i = 0; $i = 0;
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -161,6 +166,8 @@ if ($result) {
$selectedfields = ''; $selectedfields = '';
$newcardbutton = ''; $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'));
if ($usercancreate) { if ($usercancreate) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type)); $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type));
} }
@ -176,6 +183,8 @@ if ($result) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($type != '') { if ($type != '') {
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
} }
@ -220,10 +229,23 @@ if ($result) {
$directdebitorder->id = $obj->rowid; $directdebitorder->id = $obj->rowid;
$directdebitorder->ref = $obj->ref; $directdebitorder->ref = $obj->ref;
$directdebitorder->datec = $obj->datec; $directdebitorder->date_echeance = $obj->datec;
$directdebitorder->amount = $obj->amount; $directdebitorder->total = $obj->amount;
$directdebitorder->statut = $obj->statut; $directdebitorder->statut = $obj->statut;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $directdebitorder->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -241,6 +263,7 @@ if ($result) {
print '<td class="right"></td>'."\n"; print '<td class="right"></td>'."\n";
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }
} else { } else {