38  global $db, $langs, $conf;
 
   43  $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$object->id;
 
   44  $head[$h][1] = $langs->trans(
'SupplierInvoice');
 
   45  $head[$h][2] = 
'card';
 
   49    $nbContact = count($object->liste_contact(-1, 
'internal')) + count($object->liste_contact(-1, 
'external'));
 
   50    $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/contact.php?facid='.$object->id;
 
   51    $head[$h][1] = $langs->trans(
'ContactsAddresses');
 
   53      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
 
   55    $head[$h][2] = 
'contact';
 
   60  if (isModEnabled(
'paymentbybanktransfer')) {
 
   61    $nbStandingOrders = 0;
 
   62    $sql = 
"SELECT COUNT(pfd.rowid) as nb";
 
   63    $sql .= 
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
 
   64    $sql .= 
" WHERE pfd.fk_facture_fourn = ".((int) $object->id);
 
   65    $sql .= 
" AND type = 'ban'";
 
   66    $resql = $db->query($sql);
 
   68      $obj = $db->fetch_object($resql);
 
   70        $nbStandingOrders = $obj->nb;
 
   75    $langs->load(
"banks");
 
   76    $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/prelevement.php?facid='.$object->id.
'&type=bank-transfer';
 
   77    $head[$h][1] = $langs->trans(
'BankTransfer');
 
   78    if ($nbStandingOrders > 0) {
 
   79      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbStandingOrders.
'</span>';
 
   81    $head[$h][2] = 
'standingorders';
 
   93    if (!empty($object->note_private)) {
 
   96    if (!empty($object->note_public)) {
 
   99    $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/note.php?facid='.$object->id;
 
  100    $head[$h][1] = $langs->trans(
'Notes');
 
  102      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
 
  104    $head[$h][2] = 
'note';
 
  108  require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  109  require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
 
  110  $upload_dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($object->id, 2, 0, 0, $object, 
'invoice_supplier').$object->ref;
 
  111  $nbFiles = count(
dol_dir_list($upload_dir, 
'files', 0, 
'', 
'(\.meta|_preview.*\.png)$'));
 
  112  $nbLinks = 
Link::count($db, $object->element, $object->id);
 
  113  $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/document.php?facid='.$object->id;
 
  114  $head[$h][1] = $langs->trans(
'Documents');
 
  115  if (($nbFiles + $nbLinks) > 0) {
 
  116    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
 
  118  $head[$h][2] = 
'documents';
 
  121  $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/info.php?facid='.$object->id;
 
  122  $head[$h][1] = $langs->trans(
'Info');
 
  123  $head[$h][2] = 
'info';
 
 
  142  global $db, $langs, $conf, $user;
 
  147  $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/card.php?id='.$object->id;
 
  148  $head[$h][1] = $langs->trans(
"SupplierOrder");
 
  149  $head[$h][2] = 
'card';
 
  153    $nbContact = count($object->liste_contact(-1, 
'internal')) + count($object->liste_contact(-1, 
'external'));
 
  154    $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/contact.php?id='.$object->id;
 
  155    $head[$h][1] = $langs->trans(
'ContactsAddresses');
 
  156    if ($nbContact > 0) {
 
  157      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
 
  159    $head[$h][2] = 
'contact';
 
  164    $langs->load(
"stocks");
 
  165    $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/dispatch.php?id='.$object->id;
 
  166    $head[$h][1] = $langs->trans(
"OrderDispatch");
 
  169    if (in_array($object->statut, array($object::STATUS_ORDERSENT, $object::STATUS_RECEIVED_PARTIALLY, $object::STATUS_RECEIVED_COMPLETELY))) {
 
  170      $sumQtyAllreadyDispatched = 0;
 
  173      if (empty($object->lines)) {
 
  174        $object->fetch_lines();
 
  176      $nbLinesOrdered = count($object->lines);
 
  177      $dispachedLines = $object->getDispachedLines(1);
 
  178      $nbDispachedLines = count($dispachedLines);
 
  180      for ($line = 0 ; $line < $nbDispachedLines; $line++) {
 
  181        $sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line][
'qty'];
 
  183      for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
 
  185        if ($object->lines[$line]->product_type == 0 || 
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES')) {
 
  186          $sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
 
  189      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched, 
'MS').
' / '.
price2num($sumQtyOrdered, 
'MS').
'</span>';
 
  192    $head[$h][2] = 
'dispatch';
 
  204    if (!empty($object->note_private)) {
 
  207    if (!empty($object->note_public)) {
 
  210    $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/note.php?id='.$object->id;
 
  211    $head[$h][1] = $langs->trans(
"Notes");
 
  213      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
 
  215    $head[$h][2] = 
'note';
 
  219  require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  220  require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
 
  222  $nbFiles = count(
dol_dir_list($upload_dir, 
'files', 0, 
'', 
'(\.meta|_preview.*\.png)$'));
 
  223  $nbLinks = 
Link::count($db, $object->element, $object->id);
 
  224  $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/document.php?id='.$object->id;
 
  225  $head[$h][1] = $langs->trans(
'Documents');
 
  226  if (($nbFiles + $nbLinks) > 0) {
 
  227    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
 
  229  $head[$h][2] = 
'documents';
 
  232  $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/info.php?id='.$object->id;
 
  233  $head[$h][1] = $langs->trans(
"Events");
 
  234  if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda', 
'myactions', 
'read') || $user->hasRight(
'agenda', 
'allactions', 
'read'))) {
 
  236    $head[$h][1] .= $langs->trans(
"Agenda");
 
  238  $head[$h][2] = 
'info';
 
 
  255  global $langs, $conf, $user, $db;
 
  258  $extrafields->fetch_name_optionals_label(
'commande_fournisseur');
 
  259  $extrafields->fetch_name_optionals_label(
'commande_fournisseurdet');
 
  260  $extrafields->fetch_name_optionals_label(
'facture_fourn');
 
  261  $extrafields->fetch_name_optionals_label(
'facture_fourn_det');
 
  262  $extrafields->fetch_name_optionals_label(
'facture_fourn_rec');
 
  263  $extrafields->fetch_name_optionals_label(
'facture_fourn_det_rec');
 
  268  $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_order.php";
 
  269  $head[$h][1] = $langs->trans(
"SupplierOrder");
 
  270  $head[$h][2] = 
'order';
 
  273  $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_invoice.php";
 
  274  $head[$h][1] = $langs->trans(
"SuppliersInvoice");
 
  275  $head[$h][2] = 
'invoice';
 
  278  $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_payment.php";
 
  279  $head[$h][1] = $langs->trans(
"SuppliersPayment");
 
  280  $head[$h][2] = 
'supplierpayment';
 
  285  $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorder_extrafields.php';
 
  286  $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrders");
 
  287  $nbExtrafields = $extrafields->attributes[
'commande_fournisseur'][
'count'];
 
  288  if ($nbExtrafields > 0) {
 
  289    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  291  $head[$h][2] = 
'supplierorder';
 
  294  $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorderdet_extrafields.php';
 
  295  $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrdersLines");
 
  296  $nbExtrafields = $extrafields->attributes[
'commande_fournisseurdet'][
'count'];
 
  297  if ($nbExtrafields > 0) {
 
  298    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  300  $head[$h][2] = 
'supplierorderdet';
 
  303  $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoice_extrafields.php';
 
  304  $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoices");
 
  305  $nbExtrafields = $extrafields->attributes[
'facture_fourn'][
'count'];
 
  306  if ($nbExtrafields > 0) {
 
  307    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  309  $head[$h][2] = 
'supplierinvoice';
 
  312  $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoicedet_extrafields.php';
 
  313  $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLines");
 
  314  $nbExtrafields = $extrafields->attributes[
'facture_fourn_det'][
'count'];
 
  315  if ($nbExtrafields > 0) {
 
  316    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  318  $head[$h][2] = 
'supplierinvoicedet';
 
  321  $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoice_rec_extrafields.php';
 
  322  $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesRec");
 
  323  $nbExtrafields = $extrafields->attributes[
'facture_fourn_rec'][
'count'];
 
  324  if ($nbExtrafields > 0) {
 
  325    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  327  $head[$h][2] = 
'attributesrec';
 
  330  $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoicedet_rec_extrafields.php';
 
  331  $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLinesRec");
 
  332  $nbExtrafields = $extrafields->attributes[
'facture_fourn_det_rec'][
'count'];
 
  333  if ($nbExtrafields > 0) {
 
  334    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  336  $head[$h][2] = 
'attributeslinesrec';
 
 
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.
 
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).
 
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.