Merge pull request #23512 from lamrani002/kanbanPaymentSalary
NEW kanban mode for pyment salaries list
This commit is contained in:
commit
e7d756008e
@ -762,4 +762,39 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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, $db;
|
||||||
|
$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, 'fk_bank')) {
|
||||||
|
$return .= ' | <span class="info-box-label">'.$this->fk_bank.'</span>';
|
||||||
|
}
|
||||||
|
if (property_exists($this, 'fk_user_author')) {
|
||||||
|
$return .= '<br><span class="info-box-status">'.$this->fk_user_author.'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property_exists($this, 'fk_typepayment')) {
|
||||||
|
$return .= '<br><span class="opacitymedium">'.$langs->trans("PaymentMode").'</span> : <span class="info-box-label">'.$this->fk_typepayment.'</span>';
|
||||||
|
}
|
||||||
|
if (property_exists($this, 'amount')) {
|
||||||
|
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
|
||||||
|
}
|
||||||
|
$return .= '</div>';
|
||||||
|
$return .= '</div>';
|
||||||
|
$return .= '</div>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
|
|||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
|
||||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||||
|
$mode = GETPOST('mode', 'alpha'); // mode view for result
|
||||||
|
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
@ -316,6 +318,9 @@ llxHeader('', $title, $help_url);
|
|||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
|
|
||||||
$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);
|
||||||
}
|
}
|
||||||
@ -385,11 +390,16 @@ print '<input type="hidden" name="action" value="list">';
|
|||||||
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.'">';
|
||||||
|
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/salaries/card.php?action=create';
|
$url = DOL_URL_ROOT.'/salaries/card.php?action=create';
|
||||||
if (!empty($socid)) {
|
if (!empty($socid)) {
|
||||||
$url .= '&socid='.$socid;
|
$url .= '&socid='.$socid;
|
||||||
}
|
}
|
||||||
|
$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('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write);
|
$newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write);
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
@ -532,8 +542,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
// Store properties in $object
|
// Store properties in $object
|
||||||
$object->setVarsFromFetchObj($obj);
|
$object->setVarsFromFetchObj($obj);
|
||||||
|
|
||||||
// Show here line of result
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
$userstatic->id = $obj->uid;
|
$userstatic->id = $obj->uid;
|
||||||
$userstatic->lastname = $obj->lastname;
|
$userstatic->lastname = $obj->lastname;
|
||||||
@ -549,30 +558,39 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
|
|
||||||
$paymentsalstatic->id = $obj->rowid;
|
$paymentsalstatic->id = $obj->rowid;
|
||||||
$paymentsalstatic->ref = $obj->rowid;
|
$paymentsalstatic->ref = $obj->rowid;
|
||||||
|
$paymentsalstatic->amount = $obj->amount;
|
||||||
|
$paymentsalstatic->fk_typepayment = $obj->payment_code;
|
||||||
|
$paymentsalstatic->datec = $obj->dateep;
|
||||||
|
$paymentsalstatic->datep = $obj->datep;
|
||||||
|
|
||||||
// Ref
|
$accountlinestatic->id = $obj->fk_bank;
|
||||||
print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n";
|
$accountlinestatic->ref = $obj->fk_bank;
|
||||||
if (!$i) {
|
$paymentsalstatic->fk_bank = $accountlinestatic->getNomUrl(1);
|
||||||
$totalarray['nbfield']++;
|
$paymentsalstatic->fk_user_author = $userstatic->getNomUrl(1);
|
||||||
}
|
|
||||||
|
|
||||||
// Ref salary
|
|
||||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
|
||||||
if (!$i) {
|
|
||||||
$totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Label payment
|
|
||||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
|
||||||
if (!$i) {
|
|
||||||
$totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Date end period
|
if ($mode == 'kanban') {
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
|
if ($i == 0) {
|
||||||
if (!$i) {
|
print '<tr><td colspan="12">';
|
||||||
$totalarray['nbfield']++;
|
print '<div class="box-flex-container">';
|
||||||
}
|
}
|
||||||
|
// Output Kanban
|
||||||
|
|
||||||
|
|
||||||
|
print $paymentsalstatic->getKanbanView('');
|
||||||
|
if ($i == (min($num, $limit) - 1)) {
|
||||||
|
print '</div>';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Show here line of result
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
// Ref
|
||||||
|
print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n";
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."</td>\n";
|
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."</td>\n";
|
||||||
@ -580,105 +598,130 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date value
|
|
||||||
/*print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
|
|
||||||
if (!$i) $totalarray['nbfield']++;*/
|
|
||||||
|
|
||||||
// Employee
|
// Ref salary
|
||||||
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type
|
// Label payment
|
||||||
print '<td>';
|
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||||
print $langs->trans("PaymentTypeShort".$obj->payment_code);
|
if (!$i) {
|
||||||
print '</td>';
|
$totalarray['nbfield']++;
|
||||||
if (!$i) {
|
}
|
||||||
$totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Chq number
|
// Date end period
|
||||||
print '<td>'.$obj->num_payment.'</td>';
|
print '<td class="center">'.dol_print_date($db->jdate($obj->dateep), 'day')."</td>\n";
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Account
|
// Date payment
|
||||||
if (isModEnabled("banque")) {
|
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||||
// Bank transaction
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Date value
|
||||||
|
/*print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
|
||||||
|
if (!$i) $totalarray['nbfield']++;*/
|
||||||
|
|
||||||
|
// Employee
|
||||||
|
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$accountlinestatic->id = $obj->fk_bank;
|
print $langs->trans("PaymentTypeShort".$obj->payment_code);
|
||||||
print $accountlinestatic->getNomUrl(1);
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td>';
|
// Chq number
|
||||||
if ($obj->fk_bank > 0) {
|
print '<td>'.$obj->num_payment.'</td>';
|
||||||
//$accountstatic->fetch($obj->fk_bank);
|
if (!$i) {
|
||||||
$accountstatic->id = $obj->bid;
|
$totalarray['nbfield']++;
|
||||||
$accountstatic->ref = $obj->bref;
|
}
|
||||||
$accountstatic->number = $obj->bnumber;
|
|
||||||
$accountstatic->iban = $obj->iban;
|
|
||||||
$accountstatic->bic = $obj->bic;
|
|
||||||
$accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
|
|
||||||
$accountstatic->clos = $obj->clos;
|
|
||||||
|
|
||||||
if (isModEnabled('accounting')) {
|
// Account
|
||||||
$accountstatic->account_number = $obj->account_number;
|
if (isModEnabled("banque")) {
|
||||||
|
// Bank transaction
|
||||||
$accountingjournal = new AccountingJournal($db);
|
print '<td>';
|
||||||
$accountingjournal->fetch($obj->fk_accountancy_journal);
|
$accountlinestatic->id = $obj->fk_bank;
|
||||||
|
print $accountlinestatic->getNomUrl(1);
|
||||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
print '</td>';
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
$accountstatic->label = $obj->blabel;
|
|
||||||
if ($accountstatic->id > 0) {
|
print '<td>';
|
||||||
print $accountstatic->getNomUrl(1);
|
if ($obj->fk_bank > 0) {
|
||||||
|
//$accountstatic->fetch($obj->fk_bank);
|
||||||
|
$accountstatic->id = $obj->bid;
|
||||||
|
$accountstatic->ref = $obj->bref;
|
||||||
|
$accountstatic->number = $obj->bnumber;
|
||||||
|
$accountstatic->iban = $obj->iban;
|
||||||
|
$accountstatic->bic = $obj->bic;
|
||||||
|
$accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
|
||||||
|
$accountstatic->clos = $obj->clos;
|
||||||
|
|
||||||
|
if (isModEnabled('accounting')) {
|
||||||
|
$accountstatic->account_number = $obj->account_number;
|
||||||
|
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$accountingjournal->fetch($obj->fk_accountancy_journal);
|
||||||
|
|
||||||
|
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||||
|
}
|
||||||
|
$accountstatic->label = $obj->blabel;
|
||||||
|
if ($accountstatic->id > 0) {
|
||||||
|
print $accountstatic->getNomUrl(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print ' ';
|
||||||
}
|
}
|
||||||
} else {
|
print '</td>';
|
||||||
print ' ';
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
||||||
|
}
|
||||||
|
$totalarray['val']['totalttcfield'] += $obj->amount;
|
||||||
|
|
||||||
|
// 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 '<td class="nowrap center">';
|
||||||
|
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 '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Amount
|
print '</tr>'."\n";
|
||||||
print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>';
|
|
||||||
if (!$i) {
|
|
||||||
$totalarray['nbfield']++;
|
|
||||||
}
|
}
|
||||||
if (!$i) {
|
|
||||||
$totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
|
|
||||||
}
|
|
||||||
$totalarray['val']['totalttcfield'] += $obj->amount;
|
|
||||||
|
|
||||||
// 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 '<td class="nowrap center">';
|
|
||||||
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 '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
if (!$i) {
|
|
||||||
$totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</tr>'."\n";
|
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user