Fix links on list from warnings dashboard

This commit is contained in:
Laurent Destailleur 2016-06-06 16:31:50 +02:00
parent 473ab18306
commit fb13225173
10 changed files with 72 additions and 25 deletions

View File

@ -1737,7 +1737,7 @@ class Adherent extends CommonObject
$response = new WorkboardResponse();
$response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24;
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1';
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
$response->img=img_object($langs->trans("Members"),"user");
$adherentstatic = new Adherent($this->db);
@ -2006,14 +2006,18 @@ class Adherent extends CommonObject
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
}
/**
* Return if a member is late (subscription late) or not
*
* @return boolean True if late, False if not late
*/
public function hasDelay()
{
global $conf;
//Only valid members
if ($this->statut <= 0) {
return false;
}
if ($this->statut <= 0) return false;
if (! $this->datefin) return false;
$now = dol_now();

View File

@ -1102,6 +1102,7 @@ class Account extends CommonObject
$sql.= " AND b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
$sql.= " AND clos = 0";
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
$resql=$this->db->query($sql);

View File

@ -105,7 +105,7 @@ foreach ($accounts as $key=>$type)
$solde = $acc->solde(1);
print '<tr '.$bc[$var].'>';
print '<td width="30%">'.$acc->getNomUrl(1).'</td>';
print '<td class="titlefield">'.$acc->getNomUrl(1).'</td>';
print '<td>'.$acc->bank.'</td>';
print '<td>'.$acc->number.'</td>';
print '<td align="center">';
@ -116,7 +116,7 @@ foreach ($accounts as $key=>$type)
setEventMessages($acc->error, $acc->errors, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
if ($result->nbtodolate) print ' &nbsp; ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
}
}
else print $langs->trans("FeatureDisabled");

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -291,7 +291,7 @@ if ($resql)
print '<td align="center">';
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):'&nbsp;');
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)))
print img_picto($langs->trans("Late"),"warning");
print ' '.img_picto($langs->trans("Late"),"warning");
else print '&nbsp;&nbsp;&nbsp;&nbsp;';
print '</td>';
}

View File

@ -1401,6 +1401,7 @@ else
print '<td>'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="2">'.$object->note_private.'</td>';
print '</tr>';
// Amount
print '<tr>';
print '<td>'.$langs->trans("AmountHT").'</td>';
print '<td>'.price($object->total_ht).'</td>';
@ -1412,9 +1413,8 @@ else
if($object->fk_statut==6) $rowspan+=2;
print '<td rowspan="'.$rowspan.'" valign="top">';
/*
* Payments
*/
// List of payments
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
$sql.= "c.code as type_code,c.libelle as payment_type";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p";
@ -1499,9 +1499,13 @@ else
}
print '</td></tr>';
// Validation date
print '<tr>';
print '<td>'.$langs->trans("DATE_SAVE").'</td>';
print '<td>'.dol_print_date($object->date_create,'dayhour').'</td></tr>';
print '<td>'.dol_print_date($object->date_create,'dayhour');
if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late"));
if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late"));
print '</td></tr>';
print '</tr>';
// User to inform
@ -1515,7 +1519,11 @@ else
$userfee=new User($db);
$userfee->fetch($object->fk_user_validator);
print $userfee->getNomUrl(1);
if (empty($userfee->email) || ! isValidEmail($userfee->email)) print img_warning($langs->trans("EmailNotValid"));
if (empty($userfee->email) || ! isValidEmail($userfee->email))
{
$langs->load("errors");
print img_warning($langs->trans("ErrorBadEMail", $userfee->email));
}
}
print '</td></tr>';
}

View File

@ -1613,6 +1613,28 @@ class ExpenseReport extends CommonObject
return -1;
}
}
/**
* Return if an expense report is late or not
*
* @param string $option 'topay' or 'toapprove'
* @return boolean True if late, False if not late
*/
public function hasDelay($option)
{
global $conf;
//Only valid members
if ($option == 'toapprove' && $this->status != 2) return false;
if ($option == 'topay' && $this->status != 5) return false;
$now = dol_now();
if ($option == 'toapprove')
return $this->datevalid < ($now - $conf->expensereport->approve->warning_delay);
else
return $this->datevalid < ($now - $conf->expensereport->payment->warning_delay);
}
}

View File

@ -81,7 +81,6 @@ $fieldstosearchall = array(
$form = new Form($db);
$formother = new FormOther($db);
$expensereporttmp=new ExpenseReport($db);
llxHeader('', $langs->trans("ListOfTrips"));
@ -104,7 +103,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
$sql.= " d.date_debut, d.date_fin,";
$sql.= " d.date_debut, d.date_fin, d.date_valid,";
$sql.= " u.rowid as id_user, u.firstname, u.lastname";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid";
@ -244,7 +243,8 @@ if ($resql)
print '</td>';
// User
if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous){
if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous)
{
print '<td class="liste_titre" align="left">';
print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td>';
@ -280,7 +280,7 @@ if ($resql)
$expensereportstatic=new ExpenseReport($db);
if($num > 0)
if ($num > 0)
{
while ($i < min($num,$limit))
{
@ -288,21 +288,27 @@ if ($resql)
$expensereportstatic->id=$objp->rowid;
$expensereportstatic->ref=$objp->ref;
$expensereportstatic->status=$objp->status;
$expensereportstatic->valid=$objp->date_valid;
$expensereportstatic->date_debut=$objp->date_debut;
$expensereportstatic->date_fin=$objp->date_fin;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
print '<td>';
print $expensereportstatic->getNomUrl(1);
print $expensereportstatic->status;
if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) print img_warning($langs->trans("Late"));
if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) print img_warning($langs->trans("Late"));
print '</td>';
print '<td align="center">'.($objp->date_debut > 0 ? dol_print_date($objp->date_debut, 'day') : '').'</td>';
print '<td align="center">'.($objp->date_fin > 0 ? dol_print_date($objp->date_fin, 'day') : '').'</td>';
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->id_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($objp->firstname, $objp->lastname).'</a></td>';
print '<td align="right">'.price($objp->total_ht).'</td>';
print '<td align="right">'.price($objp->total_tva).'</td>';
print '<td align="right">'.price($objp->total_ttc).'</td>';
$expensereporttmp->status=$objp->status;
print '<td align="right">';
//print $objp->status;
print $expensereporttmp->getLibStatut(5);
print $expensereportstatic->getLibStatut(5);
print '</td>';
print '<td></td>';

View File

@ -473,7 +473,7 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s
{
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$board=new Account($db);
$nb = $board::countAccountToReconcile();
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
if ($nb > 0)
{
$dashboardlines[] = $board->load_board($user);

View File

@ -558,6 +558,9 @@ if ($resql)
$projectstatic->user_author_id = $obj->fk_user_creat;
$projectstatic->public = $obj->public;
$projectstatic->ref = $obj->ref;
$projectstatic->datee = $obj->date_end;
$projectstatic->statut = $obj->fk_statut;
$projectstatic->opp_status = $obj->fk_opp_status;
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
if ($userAccess >= 0)
@ -570,6 +573,7 @@ if ($resql)
{
print '<td class="nowrap">';
print $projectstatic->getNomUrl(1);
if ($projectstatic->hasDelay()) print img_warning($langs->trans('Late'));
print '</td>';
}
// Title

View File

@ -213,7 +213,7 @@ else dol_print_error($db);
if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate";
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate";
$sql.= ", s.nom as name, s.rowid as socid";
$sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update";
$sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut";
@ -550,13 +550,14 @@ if ($resql)
$projectstatic->title = $obj->projecttitle;
$projectstatic->public = $obj->public;
$projectstatic->statut = $obj->projectstatus;
$projectstatic->datee = $obj->date_end;
$projectstatic->datee = $obj->projectdatee;
$taskstatic->id = $obj->id;
$taskstatic->ref = $obj->ref;
$taskstatic->label = $obj->label;
$taskstatic->fk_statut = $obj->fk_statut;
$taskstatic->progress = $obj->progress;
$taskstatic->datee = $obj->date_end;
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
if ($userAccess >= 0)
@ -607,6 +608,7 @@ if ($resql)
{
print '<td>';
print $taskstatic->getNomUrl(1,'withproject');
if ($taskstatic->hasDelay()) print img_warning("Late");
print '</td>';
}
// Label