Browse Source

Fix scrutinizer remove unused functions

Maxime Kohlhaas 3 years ago
parent
commit
0559cc08ac
2 changed files with 0 additions and 242 deletions
  1. 0 2
      htdocs/compta/index.php
  2. 0 240
      htdocs/core/lib/invoice.lib.php

+ 0 - 2
htdocs/compta/index.php

@@ -102,11 +102,9 @@ print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'bill');
 
 print '<div class="fichecenter"><div class="fichethirdleft">';
 
-//print getCustomerInvoicePieChart($socid);
 print getNumberInvoicesPieChart('customers');
 print '<br>';
 print getNumberInvoicesPieChart('fourn');
-//print getPurchaseInvoicePieChart($socid);
 print '<br>';
 print getCustomerInvoiceDraftTable($max, $socid);
 print '<br>';

+ 0 - 240
htdocs/core/lib/invoice.lib.php

@@ -245,246 +245,6 @@ function supplier_invoice_rec_prepare_head($object)
 	return $head;
 }
 
-/**
- * Return a HTML table that contains a pie chart of customer invoices
- *
- * @param	int		$socid		(Optional) Show only results from the customer with this id
- * @return	string				A HTML table that contains a pie chart of customer invoices
- */
-function getCustomerInvoicePieChart($socid = 0)
-{
-	global $conf, $db, $langs, $user;
-
-	if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
-		return '';
-	}
-
-	$sql = "SELECT count(f.rowid), f.fk_statut";
-	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
-	$sql .= ", ".MAIN_DB_PREFIX."facture as f";
-	if (empty($user->rights->societe->client->voir) && !$socid) {
-		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-	}
-	$sql .= " WHERE f.fk_soc = s.rowid";
-	$sql .= " AND f.entity IN (".getEntity('facture').")";
-	if ($user->socid) {
-		$sql .= ' AND f.fk_soc = '.((int) $user->socid);
-	}
-	if (empty($user->rights->societe->client->voir) && !$socid) {
-		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
-	}
-	$sql .= " GROUP BY f.fk_statut";
-
-	$resql = $db->query($sql);
-	if (!$resql) {
-		dol_print_error($db);
-		return '';
-	}
-
-	$num = $db->num_rows($resql);
-	$i = 0;
-
-	$total = 0;
-	$vals = array();
-
-	while ($i < $num) {
-		$row = $db->fetch_row($resql);
-		if ($row) {
-			$vals[$row[1]] = $row[0];
-			$total += $row[0];
-		}
-
-		$i++;
-	}
-
-	$db->free($resql);
-
-	include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
-
-	$result = '<div class="div-table-responsive-no-min">';
-	$result .= '<table class="noborder nohover centpercent">';
-	$result .= '<tr class="liste_titre">';
-	$result .= '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomerInvoice").'</td>';
-	$result .= '</tr>';
-
-	$objectstatic = new Facture($db);
-	$array = array(Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_CLOSED, Facture::STATUS_ABANDONED);
-	$dataseries = array();
-
-	foreach ($array as $status) {
-		$objectstatic->statut = $status;
-		$objectstatic->paye = $status == Facture::STATUS_CLOSED ? -1 : 0;
-
-		$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
-		if ($status == Facture::STATUS_DRAFT) {
-			$colorseries[$status] = '-'.$badgeStatus0;
-		}
-		if ($status == Facture::STATUS_VALIDATED) {
-			$colorseries[$status] = $badgeStatus1;
-		}
-		if ($status == Facture::STATUS_CLOSED) {
-			$colorseries[$status] = $badgeStatus9;
-		}
-		if ($status == Facture::STATUS_ABANDONED) {
-			$colorseries[$status] = $badgeStatus6;
-		}
-
-		if (!$conf->use_javascript_ajax) {
-			$result .= '<tr class="oddeven">';
-			$result .= '<td>'.$objectstatic->getLibStatut(0).'</td>';
-			$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
-			$result .= '</tr>';
-		}
-	}
-
-	if ($conf->use_javascript_ajax) {
-		$dolgraph = new DolGraph();
-		$dolgraph->SetData($dataseries);
-		$dolgraph->SetDataColor(array_values($colorseries));
-		$dolgraph->setShowLegend(2);
-		$dolgraph->setShowPercent(1);
-		$dolgraph->SetType(['pie']);
-		$dolgraph->setHeight('150');
-		$dolgraph->setWidth('300');
-		$dolgraph->draw('idgraphcustomerinvoices');
-
-		$result .= '<tr>';
-		$result .= '<td align="center" colspan="2">'.$dolgraph->show($total ? 0 : 1).'</td>';
-		$result .= '</tr>';
-	}
-
-	$result .= '<tr class="liste_total">';
-	$result .= '<td>'.$langs->trans("Total").'</td>';
-	$result .= '<td class="right">'.$total.'</td>';
-	$result .= '</tr>';
-
-	$result .= '</table>';
-	$result .= '</div>';
-
-	return $result;
-}
-
-
-/**
- * Return a HTML table that contains a pie chart of supplier invoices
- *
- * @param	int		$socid		(Optional) Show only results from the supplier with this id
- * @return	string				A HTML table that contains a pie chart of supplier invoices
- */
-function getPurchaseInvoicePieChart($socid = 0)
-{
-	global $conf, $db, $langs, $user;
-
-	if (!((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) {
-		return '';
-	}
-
-	$sql = "SELECT count(f.rowid), f.fk_statut";
-	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
-	$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
-	if (empty($user->rights->societe->client->voir) && !$socid) {
-		$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-	}
-	$sql .= " WHERE f.fk_soc = s.rowid";
-	$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
-	if ($user->socid) {
-		$sql .= ' AND f.fk_soc = '.((int) $user->socid);
-	}
-	if (empty($user->rights->societe->client->voir) && !$socid) {
-		$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
-	}
-	$sql .= " GROUP BY f.fk_statut";
-
-	$resql = $db->query($sql);
-	if (!$resql) {
-		dol_print_error($db);
-		return '';
-	}
-
-	$num = $db->num_rows($resql);
-	$i = 0;
-
-	$total = 0;
-	$vals = array();
-
-	while ($i < $num) {
-		$row = $db->fetch_row($resql);
-		if ($row) {
-			$vals[$row[1]] = $row[0];
-			$total += $row[0];
-		}
-
-		$i++;
-	}
-
-	$db->free($resql);
-
-	include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
-
-	$result = '<div class="div-table-responsive-no-min">';
-	$result .= '<table class="noborder nohover centpercent">';
-
-	$result .= '<tr class="liste_titre">';
-	$result .= '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SupplierInvoice").'</td>';
-	$result .= '</tr>';
-
-	$objectstatic = new FactureFournisseur($db);
-	$array = array(FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_CLOSED, FactureFournisseur::STATUS_ABANDONED);
-	$dataseries = array();
-
-	foreach ($array as $status) {
-		$objectstatic->statut = $status;
-		$objectstatic->paye = $status == FactureFournisseur::STATUS_CLOSED ? -1 : 0;
-
-		$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
-		if ($status == FactureFournisseur::STATUS_DRAFT) {
-			$colorseries[$status] = '-'.$badgeStatus0;
-		}
-		if ($status == FactureFournisseur::STATUS_VALIDATED) {
-			$colorseries[$status] = $badgeStatus1;
-		}
-		if ($status == FactureFournisseur::STATUS_CLOSED) {
-			$colorseries[$status] = $badgeStatus9;
-		}
-		if ($status == FactureFournisseur::STATUS_ABANDONED) {
-			$colorseries[$status] = $badgeStatus6;
-		}
-
-		if (!$conf->use_javascript_ajax) {
-			$result .= '<tr class="oddeven">';
-			$result .= '<td>'.$objectstatic->getLibStatut(0).'</td>';
-			$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
-			$result .= '</tr>';
-		}
-	}
-
-	if ($conf->use_javascript_ajax) {
-		$dolgraph = new DolGraph();
-		$dolgraph->SetData($dataseries);
-		$dolgraph->SetDataColor(array_values($colorseries));
-		$dolgraph->setShowLegend(2);
-		$dolgraph->setShowPercent(1);
-		$dolgraph->SetType(['pie']);
-		$dolgraph->setHeight('150');
-		$dolgraph->setWidth('300');
-		$dolgraph->draw('idgraphpurchaseinvoices');
-
-		$result .= '<tr>';
-		$result .= '<td align="center" colspan="2">'.$dolgraph->show($total ? 0 : 1).'</td>';
-		$result .= '</tr>';
-	}
-
-	$result .= '<tr class="liste_total">';
-	$result .= '<td>'.$langs->trans("Total").'</td>';
-	$result .= '<td class="right">'.$total.'</td>';
-	$result .= '</tr>';
-
-	$result .= '</table>';
-	$result .= '</div>';
-
-	return $result;
-}
-
 /**
  * Return an HTML table that contains a pie chart of the number of customers or supplier invoices
  *