37   global $db, $langs, $conf;
 
   42   $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$object->id;
 
   43   $head[$h][1] = $langs->trans(
'SupplierInvoice');
 
   44   $head[$h][2] = 
'card';
 
   47   if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
 
   48     $nbContact = count($object->liste_contact(-1, 
'internal')) + count($object->liste_contact(-1, 
'external'));
 
   49     $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/contact.php?facid='.$object->id;
 
   50     $head[$h][1] = $langs->trans(
'ContactsAddresses');
 
   52       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
 
   54     $head[$h][2] = 
'contact';
 
   59   if (!empty($conf->paymentbybanktransfer->enabled)) {
 
   60     $nbStandingOrders = 0;
 
   61     $sql = 
"SELECT COUNT(pfd.rowid) as nb";
 
   62     $sql .= 
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
 
   63     $sql .= 
" WHERE pfd.fk_facture_fourn = ".((int) $object->id);
 
   64     $sql .= 
" AND pfd.ext_payment_id IS NULL";
 
   67       $obj = $db->fetch_object(
$resql);
 
   69         $nbStandingOrders = $obj->nb;
 
   74     $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/prelevement.php?facid='.$object->id.
'&type=bank-transfer';
 
   75     $head[$h][1] = $langs->trans(
'BankTransfer');
 
   76     if ($nbStandingOrders > 0) {
 
   77       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbStandingOrders.
'</span>';
 
   79     $head[$h][2] = 
'standingorders';
 
   89   if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
 
   91     if (!empty($object->note_private)) {
 
   94     if (!empty($object->note_public)) {
 
   97     $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/note.php?facid='.$object->id;
 
   98     $head[$h][1] = $langs->trans(
'Notes');
 
  100       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
 
  102     $head[$h][2] = 
'note';
 
  106   require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  107   require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
 
  108   $upload_dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($object->id, 2, 0, 0, $object, 
'invoice_supplier').$object->ref;
 
  109   $nbFiles = count(
dol_dir_list($upload_dir, 
'files', 0, 
'', 
'(\.meta|_preview.*\.png)$'));
 
  110   $nbLinks = 
Link::count($db, $object->element, $object->id);
 
  111   $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/document.php?facid='.$object->id;
 
  112   $head[$h][1] = $langs->trans(
'Documents');
 
  113   if (($nbFiles + $nbLinks) > 0) {
 
  114     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
 
  116   $head[$h][2] = 
'documents';
 
  119   $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/info.php?facid='.$object->id;
 
  120   $head[$h][1] = $langs->trans(
'Info');
 
  121   $head[$h][2] = 
'info';
 
  140   global $db, $langs, $conf, $user;
 
  145   $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/card.php?id='.$object->id;
 
  146   $head[$h][1] = $langs->trans(
"SupplierOrder");
 
  147   $head[$h][2] = 
'card';
 
  150   if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
 
  151     $nbContact = count($object->liste_contact(-1, 
'internal')) + count($object->liste_contact(-1, 
'external'));
 
  152     $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/contact.php?id='.$object->id;
 
  153     $head[$h][1] = $langs->trans(
'ContactsAddresses');
 
  154     if ($nbContact > 0) {
 
  155       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
 
  157     $head[$h][2] = 
'contact';
 
  161   if (
isModEnabled(
'stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
 
  162     $langs->load(
"stocks");
 
  163     $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/dispatch.php?id='.$object->id;
 
  164     $head[$h][1] = $langs->trans(
"OrderDispatch");
 
  167     if (in_array($object->statut, array($object::STATUS_ORDERSENT, $object::STATUS_RECEIVED_PARTIALLY, $object::STATUS_RECEIVED_COMPLETELY))) {
 
  168       $sumQtyAllreadyDispatched = 0;
 
  171       if (empty($object->lines)) {
 
  172         $object->fetch_lines();
 
  174       $nbLinesOrdered = count($object->lines);
 
  175       $dispachedLines = $object->getDispachedLines(1);
 
  176       $nbDispachedLines = count($dispachedLines);
 
  178       for ($line = 0 ; $line < $nbDispachedLines; $line++) {
 
  179         $sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line][
'qty'];
 
  181       for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
 
  183         if ($object->lines[$line]->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
 
  184           $sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
 
  187       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched, 
'MS').
' / '.
price2num($sumQtyOrdered, 
'MS').
'</span>';
 
  190     $head[$h][2] = 
'dispatch';
 
  200   if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
 
  202     if (!empty($object->note_private)) {
 
  205     if (!empty($object->note_public)) {
 
  208     $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/note.php?id='.$object->id;
 
  209     $head[$h][1] = $langs->trans(
"Notes");
 
  211       $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
 
  213     $head[$h][2] = 
'note';
 
  217   require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  218   require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
 
  220   $nbFiles = count(
dol_dir_list($upload_dir, 
'files', 0, 
'', 
'(\.meta|_preview.*\.png)$'));
 
  221   $nbLinks = 
Link::count($db, $object->element, $object->id);
 
  222   $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/document.php?id='.$object->id;
 
  223   $head[$h][1] = $langs->trans(
'Documents');
 
  224   if (($nbFiles + $nbLinks) > 0) {
 
  225     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
 
  227   $head[$h][2] = 
'documents';
 
  230   $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/info.php?id='.$object->id;
 
  231   $head[$h][1] = $langs->trans(
"Events");
 
  232   if (
isModEnabled(
'agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
 
  234     $head[$h][1] .= $langs->trans(
"Agenda");
 
  236   $head[$h][2] = 
'info';
 
  253   global $langs, $conf, $user, $db;
 
  256   $extrafields->fetch_name_optionals_label(
'commande_fournisseur');
 
  257   $extrafields->fetch_name_optionals_label(
'commande_fournisseurdet');
 
  258   $extrafields->fetch_name_optionals_label(
'facture_fourn');
 
  259   $extrafields->fetch_name_optionals_label(
'facture_fourn_det');
 
  264   $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_order.php";
 
  265   $head[$h][1] = $langs->trans(
"SupplierOrder");
 
  266   $head[$h][2] = 
'order';
 
  269   $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_invoice.php";
 
  270   $head[$h][1] = $langs->trans(
"SuppliersInvoice");
 
  271   $head[$h][2] = 
'invoice';
 
  274   $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_payment.php";
 
  275   $head[$h][1] = $langs->trans(
"SuppliersPayment");
 
  276   $head[$h][2] = 
'supplierpayment';
 
  281   $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorder_extrafields.php';
 
  282   $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrders");
 
  283   $nbExtrafields = $extrafields->attributes[
'commande_fournisseur'][
'count'];
 
  284   if ($nbExtrafields > 0) {
 
  285     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  287   $head[$h][2] = 
'supplierorder';
 
  290   $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorderdet_extrafields.php';
 
  291   $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrdersLines");
 
  292   $nbExtrafields = $extrafields->attributes[
'commande_fournisseurdet'][
'count'];
 
  293   if ($nbExtrafields > 0) {
 
  294     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  296   $head[$h][2] = 
'supplierorderdet';
 
  299   $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoice_extrafields.php';
 
  300   $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoices");
 
  301   $nbExtrafields = $extrafields->attributes[
'facture_fourn'][
'count'];
 
  302   if ($nbExtrafields > 0) {
 
  303     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  305   $head[$h][2] = 
'supplierinvoice';
 
  308   $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoicedet_extrafields.php';
 
  309   $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLines");
 
  310   $nbExtrafields = $extrafields->attributes[
'facture_fourn_det'][
'count'];
 
  311   if ($nbExtrafields > 0) {
 
  312     $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
 
  314   $head[$h][2] = 
'supplierinvoicedet';
 
Class to manage predefined suppliers products.
 
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.
 
facturefourn_prepare_head($object)
Prepare array with list of tabs.
 
ordersupplier_prepare_head(CommandeFournisseur $object)
Prepare array with list of tabs.
 
supplierorder_admin_prepare_head()
Return array head with list of tabs to view object informations.
 
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
 
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.
 
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.