diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0aee2ed876d..58bd029f8de 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2785,7 +2785,7 @@ class ContratLigne extends CommonObjectLine elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); } $statusType = 'status'.$status; - if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3'; + if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status1'; if ($status == self::STATUS_CLOSED) $statusType = 'status6'; $params = array(); $reg = array(); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 1061d47a888..3c306453c00 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -109,7 +109,7 @@ $dataseries = array(); $vals = array(); // Search by status (except expired) -$sql = "SELECT count(cd.rowid), cd.statut"; +$sql = "SELECT count(cd.rowid) as nb, cd.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -126,16 +126,16 @@ if ($resql) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - $nb[$row[1]] = $row[0]; - if ($row[1] != 5) + $nb[$obj->status] = $obj->nb; + if ($obj->status != 5) { - $vals[$row[1]] = $row[0]; - $totalinprocess += $row[0]; + $vals[$obj->status] = $obj->nb; + $totalinprocess += $obj->nb; } - $total += $row[0]; + $total += $obj->nb; } $i++; } @@ -146,7 +146,7 @@ else dol_print_error($db); } // Search by status (only expired) -$sql = "SELECT count(cd.rowid), cd.statut"; +$sql = "SELECT count(cd.rowid) as nb, cd.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -165,16 +165,16 @@ if ($resql) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - $nb[$row[1].true] = $row[0]; - if ($row[1] != 5) + $nb[$obj->status.true] = $obj->nb; + if ($obj->status != 5) { - $vals[$row[1]] = $row[0]; - $totalinprocess += $row[0]; + $vals[$obj->status.true] = $obj->nb; + $totalinprocess += $obj->nb; } - $total += $row[0]; + $total += $obj->nb; } $i++; } @@ -185,6 +185,10 @@ else dol_print_error($db); } +$colorseries = array(); + +include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '
'; print ''; print ''."\n"; @@ -192,6 +196,11 @@ $listofstatus = array(0, 4, 4, 5); $bool = false; foreach ($listofstatus as $status) { $dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool]) ? (int) $nb[$status.$bool] : 0)); + if ($status == ContratLigne::STATUS_INITIAL) $colorseries[$status.$bool] = '-'.$badgeStatus0; + if ($status == ContratLigne::STATUS_OPEN && !$bool) $colorseries[$status.$bool] = $badgeStatus4; + if ($status == ContratLigne::STATUS_OPEN && $bool) $colorseries[$status.$bool] = $badgeStatus1; + if ($status == ContratLigne::STATUS_CLOSED) $colorseries[$status.$bool] = $badgeStatus6; + if (empty($conf->use_javascript_ajax)) { print ''; @@ -209,6 +218,7 @@ if (!empty($conf->use_javascript_ajax)) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3a3e0c33543..59b922977d2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3764,10 +3764,13 @@ function img_allow($allow, $titlealt = 'default') * Return image of a credit card according to its brand name * * @param string $brand Brand name of credit card + * @param string $morecss More CSS * @return string Return img tag */ -function img_credit_card($brand) +function img_credit_card($brand, $morecss = null) { + if (is_null($morecss)) $morecss = 'fa-2x'; + if ($brand == 'visa' || $brand == 'Visa') {$brand = 'cc-visa'; } elseif ($brand == 'mastercard' || $brand == 'MasterCard') {$brand = 'cc-mastercard'; } elseif ($brand == 'amex' || $brand == 'American Express') {$brand = 'cc-amex'; } @@ -3776,7 +3779,7 @@ function img_credit_card($brand) elseif ($brand == 'diners' || $brand == 'Diners club') {$brand = 'cc-diners-club'; } elseif (!in_array($brand, array('cc-visa', 'cc-mastercard', 'cc-amex', 'cc-discover', 'cc-jcb', 'cc-diners-club'))) {$brand = 'credit-card'; } - return ''; + return ''; } /** diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index af093829250..0411004c6d5 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -255,7 +255,6 @@ if ( $resql ) print ''; print ''; print ''; - } print "
'.$langs->trans("Statistics").' - '.$langs->trans("Services").'

";