diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 66f4aa94fd2..a931af375c5 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -302,7 +302,8 @@ if ($resql) print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.dol_print_date($db->jdate($obj->datec), 'day').''; - print ''.$propalstatic->LibStatut($obj->fk_statut, 5).''; + + print ''.$propalstatic->LibStatut($obj->fk_statut, 3).''; print ''; $i++; } @@ -314,7 +315,7 @@ else dol_print_error($db); /* - * Opened proposals + * Open proposals */ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { @@ -381,9 +382,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) $companystatic->canvas = $obj->canvas; print ''.$companystatic->getNomUrl(1, 'customer', 44).''."\n"; - print ''; - print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; + print ''.dol_print_date($db->jdate($obj->dp), 'day').''."\n"; + print ''.price($obj->total_ttc).''; + print ''.$propalstatic->LibStatut($obj->fk_statut, 3).''."\n"; print ''."\n"; $i++; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 651ef2862e9..8e1fa07c17a 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -315,7 +315,7 @@ if ($resql) print $companystatic->getNomUrl(1, 'company', 16); print ''; print ''.dol_print_date($db->jdate($obj->datem), 'day').''; - print ''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''; + print ''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).''; print ''; $i++; } @@ -331,7 +331,7 @@ $max = 10; */ if (!empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -353,7 +353,7 @@ if (!empty($conf->commande->enabled)) print '
'; print ''; print ''; - print ''; + print ''; if ($num) { @@ -395,13 +395,15 @@ if (!empty($conf->commande->enabled)) print $companystatic->getNomUrl(1, 'company', 24); print ''; - print ''; + print ''."\n"; + + print ''; print ''; $i++; } if ($i < $num) { - print ''; + print ''; } } @@ -415,7 +417,7 @@ if (!empty($conf->commande->enabled)) */ if (!empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -437,7 +439,7 @@ if (!empty($conf->commande->enabled)) print '
'; print '
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''.dol_print_date($db->jdate($obj->date), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'
'.$langs->trans("More").'...
'.$langs->trans("More").'...
'; print ''; - print ''; + print ''; if ($num) { @@ -479,13 +481,15 @@ if (!empty($conf->commande->enabled)) print $companystatic->getNomUrl(1, 'company'); print ''; - print ''; + print ''."\n"; + + print ''; print ''; $i++; } if ($i < $num) { - print ''; + print ''; } } print "
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''.dol_print_date($db->jdate($obj->date), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'
'.$langs->trans("More").'...
'.$langs->trans("More").'...

"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9f244722a8f..3a3e0c33543 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3305,6 +3305,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ } // If we ask an image into $url/$mymodule/img (instead of default path) + $regs = array(); if (preg_match('/^([^@]+)@([^@]+)$/i', $picto, $regs)) { $picto = $regs[1]; $path = $regs[2]; // $path is $mymodule @@ -8425,16 +8426,16 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st // For backward compatibility. Image's filename are still in French, so we use this array to convert $statusImg = array( - 'status0' => 'statut0' - ,'status1' => 'statut1' - ,'status2' => 'statut2' - ,'status3' => 'statut3' - ,'status4' => 'statut4' - ,'status5' => 'statut5' - ,'status6' => 'statut6' - ,'status7' => 'statut7' - ,'status8' => 'statut8' - ,'status9' => 'statut9' + 'status0' => 'statut0', + 'status1' => 'statut1', + 'status2' => 'statut2', + 'status3' => 'statut3', + 'status4' => 'statut4', + 'status5' => 'statut5', + 'status6' => 'statut6', + 'status7' => 'statut7', + 'status8' => 'statut8', + 'status9' => 'statut9' ); if (!empty($statusImg[$statusType])) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 797e3693614..9906a679ce1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -104,6 +104,8 @@ class CommandeFournisseur extends CommonOrder // Note: billed or not is on another field "billed" public $statuts; // List of status + public $billed; + public $socid; public $fourn_id; public $date; @@ -354,6 +356,7 @@ class CommandeFournisseur extends CommonOrder $this->socid = $obj->fk_soc; $this->fourn_id = $obj->fk_soc; $this->statut = $obj->fk_statut; + $this->status = $obj->fk_statut; $this->billed = $obj->billed; $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; @@ -694,7 +697,7 @@ class CommandeFournisseur extends CommonOrder * Return label of a status * * @param int $status Id statut - * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $billed 1=Billed * @return string Label of status */ @@ -731,14 +734,14 @@ class CommandeFournisseur extends CommonOrder $statustrans = array( 0 => 'status0', - 1 => 'status1', - 2 => 'status3', - 3 => 'status3', - 4 => 'status3', - 5 => 'status4', - 6 => 'status5', - 7 => 'status5', - 9 => 'status5', + 1 => 'status1b', + 2 => 'status1', + 3 => 'status4', + 4 => 'status4b', + 5 => 'status6', + 6 => 'status9', + 7 => 'status9', + 9 => 'status9', ); $statusClass = 'status0'; @@ -747,9 +750,10 @@ class CommandeFournisseur extends CommonOrder } $billedtext = ''; - if ($mode == 4 && $billed) { - $billedtext = ' - '.$langs->trans("Billed"); + if ($billed) { + $billedtext = ' - '.$langs->trans("Billed"); } + if ($status == 5 && $billed) $statusClass = 'status6'; $statusLong = $langs->trans($this->statuts[$status]).$billedtext; $statusShort = $langs->trans($this->statutshort[$status]); diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index d1d102e55ea..fd14deabb43 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -76,7 +76,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles * Statistics */ -$sql = "SELECT count(cf.rowid), fk_statut"; +$sql = "SELECT count(cf.rowid) as nb, fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -93,7 +93,6 @@ if ($resql) $i = 0; $total = 0; - $totalinprocess = 0; $dataseries = array(); $vals = array(); // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially @@ -101,27 +100,36 @@ if ($resql) // -> 6=Canceled -> (reopen) 2=Approved while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - if ($row[1] != 7 && $row[1] != 6 && $row[1] != 5) - { - $vals[$row[1]] = $row[0]; - $totalinprocess += $row[0]; - } - $total += $row[0]; + $vals[($obj->status == CommandeFournisseur::STATUS_CANCELED_AFTER_ORDER ? CommandeFournisseur::STATUS_CANCELED : $obj->status)] = $obj->nb; + + $total += $obj->nb; } $i++; } $db->free($resql); + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '
'; print ''; print ''; print "\n"; - foreach (array(0, 1, 2, 3, 4, 5, 6) as $status) + $listofstatus=array(0, 1, 2, 3, 4, 5, 6, 9); + foreach ($listofstatus as $status) { $dataseries[] = array($commandestatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == CommandeFournisseur::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == CommandeFournisseur::STATUS_VALIDATED) $colorseries[$status] = '-'.$badgeStatus1; + if ($status == CommandeFournisseur::STATUS_ACCEPTED) $colorseries[$status] = $badgeStatus1; + if ($status == CommandeFournisseur::STATUS_REFUSED) $colorseries[$status] = $badgeStatus9; + if ($status == CommandeFournisseur::STATUS_ORDERSENT) $colorseries[$status] = $badgeStatus4; + if ($status == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY) $colorseries[$status] = '-'.$badgeStatus4; + if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $colorseries[$status] = $badgeStatus6; + if ($status == CommandeFournisseur::STATUS_CANCELED || $status == CommandeFournisseur::STATUS_CANCELED_AFTER_ORDER) $colorseries[$status] = $badgeStatus9; + if (!$conf->use_javascript_ajax) { print ''; @@ -137,6 +145,7 @@ if ($resql) 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')); @@ -157,53 +166,6 @@ else dol_print_error($db); } -/* - * Legends / Status - */ - -$sql = "SELECT count(cf.rowid) as nb, cf.fk_statut"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " WHERE cf.fk_soc = s.rowid"; -$sql .= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing -if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; -$sql .= " GROUP BY cf.fk_statut"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print '
'; - print '
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'
'; - - print ''; - print ''; - print "\n"; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - print ''; - print ''; - print ''; - - print "\n"; - $i++; - } - print "
'.$langs->trans("Status").''.$langs->trans("Nb").'
'.$commandestatic->LibStatut($obj->nb).''.$obj->nb.' '.$commandestatic->LibStatut($obj->fk_statut, 3).'

"; - $db->free($resql); -} -else -{ - dol_print_error($db); -} - - /* * Draft orders */ @@ -322,7 +284,7 @@ print '
'; */ $max = 5; -$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.tms, s.nom as name, s.rowid as socid"; +$sql = "SELECT c.rowid, c.ref, c.fk_statut as status, c.tms, c.billed, s.nom as name, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -376,7 +338,7 @@ if ($resql) print ''.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''; print ''.dol_print_date($db->jdate($obj->tms), 'day').''; - print ''.$commandestatic->LibStatut($obj->fk_statut, 5).''; + print ''.$commandestatic->LibStatut($obj->status, 3, $obj->billed).''; print ''; $i++; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 1ef8510016c..2c23f578fb4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1150,7 +1150,7 @@ if ($action == 'create') } else { print ''; print $form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").''; + print ' '; print ''; } print ''."\n"; @@ -1230,8 +1230,8 @@ if ($action == 'create') print ''; print ''.$langs->trans("Project").''; - $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">'.$langs->trans("AddProject").''; + $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); + print '   id).'">'; print ''; print ''; @@ -1534,7 +1534,7 @@ if ($action == 'create') print ''; - if ($action != 'editconditions' && $object->statut == SupplierProposal::STATUS_DRAFT) + if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'
'; print ''; @@ -1575,7 +1575,7 @@ if ($action == 'create') print ''; - if ($action != 'editmode' && $object->statut == $object::STATUS_VALIDATED) + if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; print ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f2371c5f558..d1d3b08bc2d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2233,7 +2233,7 @@ class SupplierProposal extends CommonObject if ($status == self::STATUS_DRAFT) $statusnew = 'status0'; elseif ($status == self::STATUS_VALIDATED) $statusnew = 'status1'; elseif ($status == self::STATUS_SIGNED) $statusnew = 'status4'; - elseif ($status == self::STATUS_NOTSIGNED) $statusnew = 'status5'; + elseif ($status == self::STATUS_NOTSIGNED) $statusnew = 'status9'; elseif ($status == self::STATUS_CLOSE) $statusnew = 'status6'; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusnew, $mode); diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 89663883084..b0c589010aa 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -292,7 +292,7 @@ if ($resql) print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.dol_print_date($db->jdate($obj->datec), 'day').''; - print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 5).''; + print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).''; print ''; $i++; } diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 48619dfc7d0..ed609ddbc87 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -1,9 +1,6 @@ -/*