NEW Show a badge with number of withdraw requests done on the withdraw

tab of invoice.
This commit is contained in:
Laurent Destailleur 2016-03-13 01:20:54 +01:00
parent 368b4c621f
commit a5571b1040
2 changed files with 15 additions and 1 deletions

View File

@ -454,7 +454,7 @@ if ($object->id > 0)
/*
* Withdrawal request
* Withdrawal opened requests
*/
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
@ -564,6 +564,8 @@ if ($object->id > 0)
dol_print_error($db);
}
// Closed requests
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande,";
$sql.= " pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
$sql.= " pb.ref,";

View File

@ -64,8 +64,20 @@ function facture_prepare_head($object)
//if ($fac->mode_reglement_code == 'PRE')
if (! empty($conf->prelevement->enabled))
{
$nbStandingOrders=0;
$sql = "SELECT COUNT(pfd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE pfd.fk_facture = ".$object->id;
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if ($obj) $nbStandingOrders = $obj->nb;
}
else dol_print_error($db);
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
$head[$h][1] = $langs->trans('StandingOrders');
if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
$head[$h][2] = 'standingorders';
$h++;
}