36   global $db, $langs, $conf, $user;
 
   38     $langs->load(
"sendings");
 
   40   $langs->load(
"orders");
 
   45   if (
isModEnabled(
'commande') && $user->hasRight(
'commande', 
'lire')) {
 
   46     $head[$h][0] = DOL_URL_ROOT.
'/commande/card.php?id='.$object->id;
 
   47     $head[$h][1] = $langs->trans(
"CustomerOrder");
 
   48     $head[$h][2] = 
'order';
 
   52   if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
 
   53     $nbContact = count($object->liste_contact(-1, 
'internal')) + count($object->liste_contact(-1, 
'external'));
 
   54     $head[$h][0] = DOL_URL_ROOT.
'/commande/contact.php?id='.$object->id;
 
   55     $head[$h][1] = $langs->trans(
'ContactsAddresses');
 
   57       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
 
   59     $head[$h][2] = 
'contact';
 
   63   if ((
isModEnabled(
'expedition_bon') && $user->hasRight(
'expedition', 
'lire'))
 
   64   || (
isModEnabled(
'delivery_note') && $user->hasRight(
'expedition', 
'delivery', 
'lire'))) {
 
   65     $nbShipments = $object->getNbOfShipments();
 
   67     $head[$h][0] = DOL_URL_ROOT.
'/expedition/shipment.php?id='.$object->id;
 
   70       $text .= $langs->trans(
"Shipments");
 
   76       $text .= $langs->trans(
"Receivings");
 
   78     if ($nbShipments > 0 || $nbReceiption > 0) {
 
   79       $text .= 
'<span class="badge marginleftonlyshort">'.($nbShipments ? $nbShipments : 0);
 
   85       $text .= ($nbReceiption ? $nbReceiption : 0);
 
   87     if ($nbShipments > 0 || $nbReceiption > 0) {
 
   91     $head[$h][2] = 
'shipping';
 
  101   if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
 
  103     if (!empty($object->note_private)) {
 
  106     if (!empty($object->note_public)) {
 
  109     $head[$h][0] = DOL_URL_ROOT.
'/commande/note.php?id='.$object->id;
 
  110     $head[$h][1] = $langs->trans(
'Notes');
 
  112       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
 
  114     $head[$h][2] = 
'note';
 
  118   require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  119   require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
 
  120   $upload_dir = $conf->commande->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
 
  121   $nbFiles = count(
dol_dir_list($upload_dir, 
'files', 0, 
'', 
'(\.meta|_preview.*\.png)$'));
 
  122   $nbLinks = 
Link::count($db, $object->element, $object->id);
 
  123   $head[$h][0] = DOL_URL_ROOT.
'/commande/document.php?id='.$object->id;
 
  124   $head[$h][1] = $langs->trans(
'Documents');
 
  125   if (($nbFiles + $nbLinks) > 0) {
 
  126     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
 
  128   $head[$h][2] = 
'documents';
 
  131   $head[$h][0] = DOL_URL_ROOT.
'/commande/info.php?id='.$object->id;
 
  132   $head[$h][1] = $langs->trans(
"Info");
 
  133   $head[$h][2] = 
'info';
 
  150   global $langs, $conf, $user, $db;
 
  153   $extrafields->fetch_name_optionals_label(
'commande');
 
  154   $extrafields->fetch_name_optionals_label(
'commandedet');
 
  159   $head[$h][0] = DOL_URL_ROOT.
'/admin/commande.php';
 
  160   $head[$h][1] = $langs->trans(
"Miscellaneous");
 
  161   $head[$h][2] = 
'general';
 
  166   $head[$h][0] = DOL_URL_ROOT.
'/admin/order_extrafields.php';
 
  167   $head[$h][1] = $langs->trans(
"ExtraFields");
 
  168   $nbExtrafields = $extrafields->attributes[
'commande'][
'count'];
 
  169   if ($nbExtrafields > 0) {
 
  170     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  172   $head[$h][2] = 
'attributes';
 
  175   $head[$h][0] = DOL_URL_ROOT.
'/admin/orderdet_extrafields.php';
 
  176   $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
 
  177   $nbExtrafields = $extrafields->attributes[
'commandedet'][
'count'];
 
  178   if ($nbExtrafields > 0) {
 
  179     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  181   $head[$h][2] = 
'attributeslines';
 
  199   global $conf, $db, $langs, $user;
 
  203   if (!
isModEnabled(
'commande') || !$user->hasRight(
'commande', 
'lire')) {
 
  207   $commandestatic = 
new Commande($db);
 
  213   $sql = 
"SELECT count(c.rowid) as nb, c.fk_statut as status";
 
  214   $sql .= 
" FROM ".MAIN_DB_PREFIX.
"societe as s";
 
  215   $sql .= 
", ".MAIN_DB_PREFIX.
"commande as c";
 
  216   if (empty($user->rights->societe->client->voir) && !$socid) {
 
  217     $sql .= 
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
 
  219   $sql .= 
" WHERE c.fk_soc = s.rowid";
 
  220   $sql .= 
" AND c.entity IN (".getEntity(
'societe').
")";
 
  222     $sql .= 
' AND c.fk_soc = '.((int) $user->socid);
 
  224   if (empty($user->rights->societe->client->voir) && !$socid) {
 
  225     $sql .= 
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
 
  227   $sql .= 
" GROUP BY c.fk_statut";
 
  229   $resql = $db->query($sql);
 
  231     $num = $db->num_rows(
$resql);
 
  236     $dataseries = array();
 
  237     $colorseries = array();
 
  241       $row = $db->fetch_row(
$resql);
 
  245         if (!isset($vals[$row[1]])) {
 
  248           $vals[$row[1]] += $row[0];
 
  249           $totalinprocess += $row[0];
 
  257     include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
 
  259     $result = 
'<div class="div-table-responsive-no-min">';
 
  260     $result .= 
'<table class="noborder nohover centpercent">';
 
  261     $result .= 
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"CustomersOrders").
'</th></tr>'.
"\n";
 
  262     $listofstatus = array(0, 1, 2, 3, -1);
 
  263     foreach ($listofstatus as $status) {
 
  264       $dataseries[] = array($commandestatic->LibStatut($status, 0, 1, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
 
  266         $colorseries[$status] = 
'-'.$badgeStatus0;
 
  269         $colorseries[$status] = $badgeStatus1;
 
  272         $colorseries[$status] = $badgeStatus4;
 
  275         $colorseries[$status] = $badgeStatus6;
 
  278         $colorseries[$status] = $badgeStatus6;
 
  281         $colorseries[$status] = $badgeStatus9;
 
  284       if (empty($conf->use_javascript_ajax)) {
 
  285         $result .= 
'<tr class="oddeven">';
 
  286         $result .= 
'<td>'.$commandestatic->LibStatut($status, 0, 0, 1).
'</td>';
 
  287         $result .= 
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
' ';
 
  288         $result .= $commandestatic->LibStatut($status, 0, 3, 1);
 
  289         $result .= 
'</a></td>';
 
  290         $result .= 
"</tr>\n";
 
  293     if (!empty($conf->use_javascript_ajax)) {
 
  294       $result .= 
'<tr class="impair"><td align="center" colspan="2">';
 
  296       include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
 
  298       $dolgraph->SetData($dataseries);
 
  299       $dolgraph->SetDataColor(array_values($colorseries));
 
  300       $dolgraph->setShowLegend(2);
 
  301       $dolgraph->setShowPercent(1);
 
  302       $dolgraph->SetType(array(
'pie'));
 
  303       $dolgraph->setHeight(
'150');
 
  304       $dolgraph->setWidth(
'300');
 
  305       $dolgraph->draw(
'idgraphstatus');
 
  306       $result .= $dolgraph->show($total ? 0 : 1);
 
  308       $result .= 
'</td></tr>';
 
  312     $result .= 
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">'.$total.
'</td></tr>';
 
  313     $result .= 
"</table></div><br>";
 
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
static count($dbs, $objecttype, $objectid)
Return nb of links.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
isModEnabled($module)
Is Dolibarr module enabled.
order_admin_prepare_head()
Return array head with list of tabs to view object informations.
getCustomerOrderPieChart($socid=0)
Return a HTML table that contains a pie chart of sales orders.
commande_prepare_head(Commande $object)
Prepare array with list of tabs.