NEW Add badge for generate invoice client tab (#31559)
* Add badge for generate invoice client tab * urlencode for add to url
This commit is contained in:
parent
9ad982ad23
commit
dcf7f91f71
2 changed files with 20 additions and 2 deletions
|
|
@ -1251,8 +1251,11 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
|||
$newcardbutton = '';
|
||||
if ($contextpage != 'poslist') {
|
||||
$url = DOL_URL_ROOT.'/compta/facture/card.php?action=create';
|
||||
if (!empty($socid)) {
|
||||
$url .= '&socid='.$socid;
|
||||
if (!empty($object->socid)) {
|
||||
$url .= '&socid='.urlencode((string) $object->socid);
|
||||
}
|
||||
if (!empty($object->id)) {
|
||||
$url .= '&fac_rec='.urlencode((string) $object->id);
|
||||
}
|
||||
$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'));
|
||||
|
|
|
|||
|
|
@ -264,6 +264,21 @@ function invoice_rec_prepare_head($object)
|
|||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/list.php?search_fk_fac_rec_source=' . $object->id;
|
||||
$head[$h][1] = $langs->trans('InvoicesGeneratedFromRec');
|
||||
//count facture rec
|
||||
$nbFacture = 0;
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " WHERE fk_fac_rec_source = ".((int) $object->id);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbFacture = $obj->nb;
|
||||
} else {
|
||||
dol_syslog('Failed to count facture with facture_rec '.$db->lasterror(), LOG_ERR);
|
||||
}
|
||||
if ($nbFacture > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbFacture.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'generated';
|
||||
$h++;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue