36 global $db, $langs, $conf;
41 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$object->id;
42 $head[$h][1] = $langs->trans(
'SupplierInvoice');
43 $head[$h][2] =
'card';
46 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
47 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
48 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/contact.php?facid='.$object->id;
49 $head[$h][1] = $langs->trans(
'ContactsAddresses');
51 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
53 $head[$h][2] =
'contact';
58 if (!empty($conf->paymentbybanktransfer->enabled)) {
59 $nbStandingOrders = 0;
60 $sql =
"SELECT COUNT(pfd.rowid) as nb";
61 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_facture_demande as pfd";
62 $sql .=
" WHERE pfd.fk_facture_fourn = ".((int) $object->id);
63 $sql .=
" AND pfd.ext_payment_id IS NULL";
66 $obj = $db->fetch_object(
$resql);
68 $nbStandingOrders = $obj->nb;
73 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/prelevement.php?facid='.$object->id.
'&type=bank-transfer';
74 $head[$h][1] = $langs->trans(
'BankTransfer');
75 if ($nbStandingOrders > 0) {
76 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbStandingOrders.
'</span>';
78 $head[$h][2] =
'standingorders';
88 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
90 if (!empty($object->note_private)) {
93 if (!empty($object->note_public)) {
96 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/note.php?facid='.$object->id;
97 $head[$h][1] = $langs->trans(
'Notes');
99 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
101 $head[$h][2] =
'note';
105 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
106 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
107 $upload_dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($object->id, 2, 0, 0, $object,
'invoice_supplier').$object->ref;
108 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
109 $nbLinks =
Link::count($db, $object->element, $object->id);
110 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/document.php?facid='.$object->id;
111 $head[$h][1] = $langs->trans(
'Documents');
112 if (($nbFiles + $nbLinks) > 0) {
113 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
115 $head[$h][2] =
'documents';
118 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/info.php?facid='.$object->id;
119 $head[$h][1] = $langs->trans(
'Info');
120 $head[$h][2] =
'info';
137 global $db, $langs, $conf, $user;
142 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/card.php?id='.$object->id;
143 $head[$h][1] = $langs->trans(
"SupplierOrder");
144 $head[$h][2] =
'card';
147 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
148 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
149 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/contact.php?id='.$object->id;
150 $head[$h][1] = $langs->trans(
'ContactsAddresses');
151 if ($nbContact > 0) {
152 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
154 $head[$h][2] =
'contact';
158 if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
159 $langs->load(
"stocks");
160 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/dispatch.php?id='.$object->id;
161 $head[$h][1] = $langs->trans(
"OrderDispatch");
164 if (in_array($object->statut, array($object::STATUS_ORDERSENT, $object::STATUS_RECEIVED_PARTIALLY, $object::STATUS_RECEIVED_COMPLETELY))) {
165 $sumQtyAllreadyDispatched = 0;
168 if (empty($object->lines)) {
169 $object->fetch_lines();
171 $nbLinesOrdered = count($object->lines);
172 $dispachedLines = $object->getDispachedLines(1);
173 $nbDispachedLines = count($dispachedLines);
175 for ($line = 0 ; $line < $nbDispachedLines; $line++) {
176 $sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line][
'qty'];
178 for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
179 $sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
181 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched,
'MS').
' / '.
price2num($sumQtyOrdered,
'MS').
'</span>';
184 $head[$h][2] =
'dispatch';
194 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
196 if (!empty($object->note_private)) {
199 if (!empty($object->note_public)) {
202 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/note.php?id='.$object->id;
203 $head[$h][1] = $langs->trans(
"Notes");
205 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
207 $head[$h][2] =
'note';
211 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
212 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
214 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
215 $nbLinks =
Link::count($db, $object->element, $object->id);
216 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/document.php?id='.$object->id;
217 $head[$h][1] = $langs->trans(
'Documents');
218 if (($nbFiles + $nbLinks) > 0) {
219 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
221 $head[$h][2] =
'documents';
224 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/info.php?id='.$object->id;
225 $head[$h][1] = $langs->trans(
"Events");
226 if (
isModEnabled(
'agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
228 $head[$h][1] .= $langs->trans(
"Agenda");
230 $head[$h][2] =
'info';
243 global $langs, $conf, $user;
248 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_order.php";
249 $head[$h][1] = $langs->trans(
"SupplierOrder");
250 $head[$h][2] =
'order';
253 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_invoice.php";
254 $head[$h][1] = $langs->trans(
"SuppliersInvoice");
255 $head[$h][2] =
'invoice';
258 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_payment.php";
259 $head[$h][1] = $langs->trans(
"SuppliersPayment");
260 $head[$h][2] =
'supplierpayment';
265 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorder_extrafields.php';
266 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrders");
267 $head[$h][2] =
'supplierorder';
270 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorderdet_extrafields.php';
271 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrdersLines");
272 $head[$h][2] =
'supplierorderdet';
275 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoice_extrafields.php';
276 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoices");
277 $head[$h][2] =
'supplierinvoice';
280 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoicedet_extrafields.php';
281 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLines");
282 $head[$h][2] =
'supplierinvoicedet';